Tell us what’s happening:
Here is my solution to the Chunky Monkey challenge.
It solves half of the examples given. I have followed the algorithm but cannot see any flaws in the logic.
Your code so far
function chunkArrayInGroups(arr, size) {
// Break it up.
var count = 0;
var arrNew = [];
var arrFin = [];
for ( var i = 0; i < arr.length ; i += size) {
arrNew = arr.slice(i , size + size * count );
arrFin.push(arrNew);
count =+ 1;
}
return arrFin;
}
chunkArrayInGroups([0,1,2,3,4,5,6], 3);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
.
Link to the challenge: