Tell us what’s happening:
Okay, so I guess I’m nearly there. But somehow it is taking the second index along with it while slicing…
Can anyone explain what I might be doing wrong…?
Your code so far
var chunkedArray = [];
for (var i = 0; i < arr.length; i++) {
chunkedArray.push(arr.slice(i, i+size));
}
console.log(chunkedArray); //[a,b],[b,c],[c,d],[d]
return chunkedArray;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/chunky-monkey