new Map iteration example js
Example 1: loop through map in js
var myMap = new Map();
myMap.set("0", "foo");
myMap.set(1, "bar");
myMap.set({}, "baz");
for (const [key, value] of myMap.entries()) {
console.log(key, value);
}
Example 2: js loop trough map
for (let key of map) {
console.log(key);
}