array-for-each-x

3.1.2 • Public • Published

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

array-for-each-x

Executes a provided function once for each array element.

module.exports

This method executes a provided function once for each array element.

Kind: Exported member
Throws:

  • TypeError If array is null or undefined.
  • TypeError If callBack is not a function.
Param Type Description
array array The array to iterate over.
callBack function Function to execute for each element.
[thisArg] * Value to use as this when executing callback.

Example

import forEach from 'array-for-each-x';
 
const items = ['item1', 'item2', 'item3'];
const copy = [];
 
forEach(items, function(item) {
  copy.push(item);
});
 
console.log(copy); // ['item1', 'item2', 'item3']

/array-for-each-x/

    Package Sidebar

    Install

    npm i array-for-each-x

    Weekly Downloads

    189

    Version

    3.1.2

    License

    MIT

    Unpacked Size

    299 kB

    Total Files

    11

    Last publish

    Collaborators

    • xotic750