For the complete documentation index, see llms.txt. This page is also available as Markdown.

ArrayChunk

Chunks the array into an array of arrays of the specified size.

The final chunk may be shorter if the array does not divide evenly.

 numbers = [ 1, 2, 3, 4, 5 ];
 numbers.chunk( 2 ); // [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]
 

Method Signature

ArrayChunk(array=[array], length=[integer])

Arguments

Argument
Type
Required
Description
Default

array

array

true

The array to chunk.

length

integer

true

The size of each chunk.

Examples

Last updated

Was this helpful?