Javascript Map object

Date: 2020-01-29

https://medium.com/front-end-weekly/es6-map-vs-object-what-and-when-b80621932373

https://jsperf.com/comparing-object-map-methods

var map = new Map([[1,2],[3,4]]);
map.get(1)// 2
map.has(1);//return boolean value:  true/false
map.set(4,5); //{1=>2, 2=>3, 4=>5}
map.delete(1); //{ 2=>3, 4=>5}
map.clear(); //{}
map.size;//0

// loop key/values (fast!)
let result = {}
for (var [key, value] of map.entries()) {
  result[key] = value * 2;
}
32950cookie-checkJavascript Map object