Tell us what’s happening:
I can’t pass the last test. What am I missing here?
Your code so far
function chunkArrayInGroups(arr, size) {
// Break it up.
let newArr = [];
for(let i = 0; i < arr.length; i++) {
let arrs = arr.splice(0,size);
newArr.push(arrs);
}
if(arr.length === 0){
return newArr;
} else {
newArr.push(arr);
}
return newArr;
}
chunkArrayInGroups(["a", "b", "c", "d", "e"], 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey