创建
var map=new Map();
赋值
map.set('a','1');
map.set('b','2');
map.set('c','3');
map.set('d','4');
取值
map.get('a');
删除
map.delete('a');
for of & map
for(var key of map){
console.log(key);
}
for(var [key,value] of map){
console.log(key, value);
}
}
for(var [a,b] of map.entries()){
console.log(a,b);
}
for(var key of map.keys()){
console.log(key);
}
for(var val of map.values()){
console.log(val);
}