JavaScript: Map.prototype.forEach

By Xah Lee. Date: . Last updated: .

New in JS2015.

Apply function f to all entries in map map_obj in the order the entries are inserted. Does not modify the map object. Return undefined.
f is passed 3 arguments: value, key, map_obj. Note the order in parameter is value first.
map_obj.forEach(f, thisArg)
Use thisArg for this Binding of f. If it is not given, undefined is used.
const mm = new Map( [["a", 1], ["b",2] ]);

const rr = mm.forEach( (v,k) => { console.log(v, k); } );
// prints
// 1 'a'
// 2 'b'

// returns undefined
console.log( rr === undefined ); // true

See also: Iterate Over Map Object

JavaScript in Depth

JS Obj Reference