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