Array.chunk

Array.chunk

Array.chunk

Function

Split the array into a two-dimensional array according to the specified size.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
sizeNumberNo1The number of elements in each group.

Return value

TypeDescription
ArraySplit two-dimensional array.

Code Example

Notes

  • Returns an empty array when size is less than or equal to 0.