Map (exMap:{"name":"abc","sex",'male'}):
在不知道key的情況下遍歷map:
網上說過這種方法:
for(var key in exMap){
Console.w(" key:" key ";value:" exMap[key]);//經我考證,the key is undefined.So the method is not right.
}
另一種方法(Good):
$.each(exMap,function(exMap,function(exMap,function(exMap,function(exMap,function) key,value){
Console.wiite("key:" key ";value:" value);
});
在知道的key的情況下遍歷map自然就跟數組一樣的訪問羅,這裡就不說了。
List存取很簡單:
for(var i =0;ivalue = list[i]
}
參考(jquery篩選數組之grep、each、inArray、map的用法及遍歷json物件):
http://sjolzy.cn/jquery-selection-and-use-of-an-array-of-grepeachinArraymap-json-object-traversal.html