Skip to content

forEach

Subhajit Sahu edited this page Jun 7, 2020 · 14 revisions

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

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

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

references

Clone this wiki locally