我在这里读到,窗口对象可用于在对象中动态创建属性名称。这是怎么做的
我有一个像
function storeValues(){
var info = {};
$('.class1').each(function(index1, value1){
$('.class2', $(this)).each(function(index2, value2){
//so here I'd like to add a string to the property name
//like 'param-' and 'detail-' so I could end up with a
//structure like
//info.param_0.detail_0
//then
//info.param_0.detail_1
//info.param_1.detail_0
//info.param_1.detail_1
//info.param_1.detail_2
info.'param_'index1.'detail_'index2 = $(this).find('.desired_input').val();
});
}
这可能吗。或者有更聪明的方法吗?