Skip to content

forEach

Subhajit Sahu edited this page Jun 15, 2020 · 18 revisions

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

iterable.forEach(x, fn);
// x:  an iterable
// fn: called function (v, i, x)
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