forEach < Map < JavaScript
The forEach() method of the Map object executes a provided function once per each key/value pair in the map, in insertion order.
const things = new Map([
['Detroit', 'Michigan'],
['year_founded', 1701],
[{}, 'empty_object'],
['leadership', {"mayor":"Mike Duggan"}],
['future', undefined],
]);
things.forEach((value, key) =>
console.log(`${key} = ${value}`)
);
// "Detroit = Michigan"
// "year_founded = 1701"
// "= empty_object"
// "leadership = [object Object]"
// "future = undefined"