JS: Map.prototype.forEach
(new in ECMAScript 2015)
mapObj.forEach(f)-
- Apply function f to all entries in map mapObj in the order the entries are inserted. Does not modify the map object.
- Return undefined.
f is passed 3 arguments: value, key, mapObj. Note the order in parameter is value first.
const xx = new Map([["a", 1], ["b", 2]]); const xout = xx.forEach((v, k) => { console.log(v, k); }); /* 1 a 2 b */ // returns undefined console.assert(xout === undefined); mapObj.forEach(f, thisArg)-
Use thisArg for this (binding) of f. If it is not given, undefined is used.
JavaScript. Loop, Iteration
JS Map.prototype
- JS: Map.prototype.constructor
- JS: Map.prototype.size
- JS: Map.prototype[Symbol.toStringTag]
- JS: Map.prototype.get
- JS: Map.prototype.set
- JS: Map.prototype.has
- JS: Map.prototype.delete
- JS: Map.prototype.clear
- JS: Map.prototype.forEach
- JS: Map.prototype.keys
- JS: Map.prototype.values
- JS: Map.prototype.entries