Lodash _.chunk() Method
Parameters: This function accepts two parameters as mentioned above and describe below.
- array: An array to be processed by chunk function.
- size: This describes the size of chunk.
Return Value: It returns the array of chunks that is also an array
Note: Please install lodash module by using command
npm install lodash before using the code given below.
Example 2: The size of chunk can be varied and array of different data type can be used with chunk function.
Example 3: Using array of array with chunk.
Example 4: Using array of Objects with chunk.