Tell us what’s happening:
I don’t understand why it doesn’t pass the test. I do see that at the begining and end of the array is a space that should’t be but I don’t understant why it is and how to correct that ! Thanks for your time.
Your code so far
let newArray = [];
let arrayHold = [];
function chunkArrayInGroups(arr, num){
outloop: for(let i = 0; i<=arr.length; i += num){
newArray = arr.slice(i, i+num);
if(newArray == ""){
break;
}
arrayHold.push(newArray);
}
return arrayHold;
}
let array = [0, 1, 2, 3, 4, 5, 6, 7, 8];
let num = 2;
chunkArrayInGroups(array, num);
console.log(arrayHold);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Challenge Information:
Implement the Chunky Monkey Algorithm - Implement the Chunky Monkey Algorithm