iterate javascript map code example
Example 1: loop through map in js
const object = {'a': 1, 'b': 2, 'c' : 3};
for (const [key, value] of Object.entries(object)) {
console.log(key, value);
}
Example 2: js foreach key value
Object.keys(obj).forEach(function (key) {
// do something with obj[key]
});
Example 3: iteratea on values map js
map.values((value) => /* do whatever with value */)