Hi there,
I’ve a problem with the chunky monkey challenge.
My code seems to give the right answer, but FCC doesn’t recognize it like that. I have to return a nested array: [[X, X], [X, X]]. In the console I cannot see the difference between a normal and a nested array, so I cannot see if that is the problem.
function chunkArrayInGroups(arr, size) {
// Break it up.
let newArr = [];
let fullArr = [];
let increasement = 0
for (let i=0; i<arr.length; i+=size) {
newArr.push(arr.slice(increasement, i+size));
increasement = increasement + size;
fullArr.push(newArr);
newArr = [];
}
console.log(fullArr)
return fullArr;
}
chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3);
Whats going on?