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
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn