Map (exMap:{"name":"abc","sex",'male'}):
Traverse the map without knowing the key:
This method has been said on the Internet:
for(var key in exMap){
Console.write(" key:" key ";value:" exMap[key]);//After my research, the key is undefined.So the method is not right.
}
Another method (Good):
$.each(exMap,function( key, value){
Console.wiite("key:" key ";value:" value);
});
It is natural to traverse the map when knowing the key Just like accessing arrays, we won’t go into details here.
List access is very simple:
for(var i =0;ivalue = list[i]
}
Reference (jquery filtering array grep, each, inArray, map usage and Traversing json objects):
http://sjolzy.cn/jquery-selection-and-use-of-an-array-of-grepeachinArraymap-json-object-traversal.html