SOURCE

const map=new Map([
  ['a',1],
  ['b',2]
]);
console.log(map);  //Map(2){"a"=>1,"b"=>2}
console.log(map.size);  //2

map.set('miaov','ketang').set('new','fq');
console.log(map);  //Map(4){'a'=>1,'b'=>2,'miaov'=>ketang,'new'=>fq}

map.set('miaov','ketang').set('new','fq').set('miaov','leo');
console.log(map);  //Map(4){'a'=>1,'b'=>2,'miaov'=>leo,'new'=>fq}

console.log(map.get('new'));  //fq
console.log(map.get('x'));  //undefined

console.log(map.deleted('a'));
console.log(map);

console.log(map.deleted('a'));  //false

console.log(map.has('miaov'));  //true
console.log(map.has('a'));  //false

// console.log(map.clear());

console.log(map.keys());  //MapIterator{'b','miaov','new'}

console.log(map.values());
//MapIterator{2,'leo','fq'}

console.log(map.entries());  //MapIterator{['b',2],['miaov','leo'],['new','fq']}

map.forEach(function(key,value,map){
  console.log(key+":"+value)
})






console 命令行工具 X clear

                    
>
console