Map (exMap:{"name":"abc","sex",'male'}):
在不知道key的情况下遍历map:
网上说过这种方法:
for(var key in exMap){
Console.write("key:"+key+";value:"+exMap[key]);//经我考证,the key is undefined.So the method is not right.
}
另外一种方法(Good):
$.each(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
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