Skip to content

forEach

Subhajit Sahu edited this page Feb 3, 2021 · 18 revisions

Call a function for each value.


function forEach(x, fp)
// x:  an iterable
// fp: process function (v, i, x)
const xiterable = require('extra-iterable');

var x = [1, 2, -3, -4];
xiterable.forEach(x, v => console.xiterable.log(v));
// → 1
// → 2
// → -3
// → -4


References