node js iterate map code example
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 foreach key value
Object.keys(obj).forEach(function (key) {
// do something with obj[key]
});