Tell us what’s happening:
I think I solved the challenge correctly, but I was not able to pass the test. The results I got should be correct, does anyone know where the problem might be?
Thanks a lot.
Your code so far
function chunkArrayInGroups(arr, size) {
// Break it up.
if (size>=arr.length){
arrglo.push(arr);
console.log(arrglo)
return arrglo;
}
else{
let arr1=arr.slice(0,size);
let arr2=arr.slice(size);
arrglo.push(arr1);
console.log(arrglo)
return chunkArrayInGroups(arr2,size);
}
}
let arrglo=[];
let a=chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2);
console.log(a)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey