const arr = ['one', 'two', 'three', 'four', 'five'];
const arr_chunks = _.chunk(arr, 2);
You can check lodash chunk syntax as below
_.chunk(Array, size);
This takes two arguments Array and size:
Array: You can pass your array as this required parameter that you want to break into chunks.
size: This is an optional parameter which takes the integer type value and create you array of arrays with the size that you enter as this parameter. By deafult the value of size is one
Live Demo
0 Comments