var Data = { "1":"United States",
"2":"United Kingdom",
"3":"Aruba",
"4":"United Kingdom",
"5":"Aruba",
"6":"Bahrain",
"7":"United Kingdom",
"8":"Algeria",
"9":"Andorra",
"10":"American Samoa"
}
var IdKeyValuePair = [{"DropD1":Data},{"DropD2":Data},{"DropD3":Data},{"DropD4":Data}];
var obj= {
id : IdKeyValuePair,
MultiColuumn : true,
Checkbox : true,
Pagination : false,
max_height : 400
};
我想打印 DropD1、DropD2 的名称。我正在尝试这种方式。但我无法做到这一点..
var idName = [],i;
idLen = obj.id.length;
for(i=0;i<idLen;i++){
idName[i] = ''+obj.id[i];
console.log(idName[i]);
}
我得到了 DropD1,DropD2 .. 但问题是它是对象形式,所以我如何将它转换为字符串......我想要一个结果是这样的格式......
for(i=0;i<idLen;i++){
console.log(idName[i]);
}
字符串格式的预期输出不在对象中:
滴D1 滴D2 滴D3