Skip to content

forEach

Subhajit Sahu edited this page Dec 5, 2022 · 14 revisions

Call a function for each value.


function forEach(x, fp)
// x:  a map
// fp: process function (v, k, x)
const map = require('extra-map');

var x = new Map([['a', 1], ['b', 2], ['c', -3], ['d', -4]]);
map.forEach(x, v => console.log(v));
// → 1
// → 2
// → -3
// → -4


References

Clone this wiki locally