var map = {}; // 赋值 var key = "key1"; var value = "value1"; map[key] = value; // 取值 alert(map[key]); if("key1" in map) { //判断是否存在 alert("OK"); } // 删除 delete map["key1"]; // 遍历 for(key in map){ console(key + map[key]); }
<<< Js对map的操作
时间: 2024-10-14 20:59:57