Skip to content

forEach

Subhajit Sahu edited this page May 17, 2020 · 18 revisions

Calls a function for each value. 🏃 📼 📦 🌔 📒

iterable.forEach(x, fn, [ths]);
// x:   an iterable
// fn:  called function (v, i, x)
// ths: this argument
const iterable = require('extra-iterable');

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

references

Clone this wiki locally