Map (exMap:{"name":"abc","sex",'male'}):
在不知道key的情況下遍歷map:
網(wǎng)上說(shuō)過(guò)這種方法:
復(fù)制代碼 代碼如下:
for(var key in exMap){
Console.write("key:"+key+";value:"+exMap[key]);//經(jīng)我考證,the key is undefined.So the method is not right.
}
復(fù)制代碼 代碼如下:
$.each(exMap,function(key,value){
Console.wiite("key:"+key+";value:"+value);
});
復(fù)制代碼 代碼如下:
for(var i =0;i<list.length;i++){
value = list[i]
}
新聞熱點(diǎn)
疑難解答
圖片精選