Split Arr First Argument Into Smaller Chunks Of Arrays With

[Solved] Split Arr First Argument Into Smaller Chunks Of Arrays With | Perl - Code Explorer | yomemimo.com
Question : split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument).

Answered by : stefany

function chunkArrayInGroups(arr, size) { let newArr = []; while (arr.length > 0) { newArr.push(arr.splice(0, size)); } return newArr;
}

Source : https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-chunky-monkey/16005 | Last Update : Mon, 28 Mar 22

Answers related to split arr first argument into smaller chunks of arrays with the length provided by size second argument

Code Explorer Popular Question For Perl