Splits array into chunks of at most size elements. The last chunk may be smaller than size.
array
size
The array to chunk.
Chunk size (must be a positive integer).
chunkArray([1, 2, 3, 4, 5], 2) // => [[1, 2], [3, 4], [5]]chunkArray([], 3) // => [] Copy
chunkArray([1, 2, 3, 4, 5], 2) // => [[1, 2], [3, 4], [5]]chunkArray([], 3) // => []
Splits
arrayinto chunks of at mostsizeelements. The last chunk may be smaller thansize.