Skip to content

Pass all array members to a callback function, n members at a time.

License

Notifications You must be signed in to change notification settings

alcacode/ArrayForEachN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Array.prototype.forEachN()

Pass all array members to a callback function, n members at a time.

Syntax

arr.forEachN(n, callback(...args)[, thisArg])

Parameters

n
Number of elements to pass to callback at a time.

callback
Function to call.

thisArg
A value to bind this to. If not set, this refers to the Array instance.

Returns

undefined.

Example

[1,2,3,4].forEachN(2, (arr) => console.log(arr));
// [ 1, 2 ]
// [ 3, 4 ]

About

Pass all array members to a callback function, n members at a time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published