Pass all array members to a callback function, n members at a time.
arr.forEachN(n, callback(...args)[, thisArg])
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.
undefined
.
[1,2,3,4].forEachN(2, (arr) => console.log(arr));
// [ 1, 2 ]
// [ 3, 4 ]