Tell us what’s happening:
Hello everyone,
Another noob question… I cannot seem to get my loop to work properly. It keeps returning the first 2 numbers over and over. What am I doing wrong?
Thank you in advance for your assistance!
Your code so far
function chunkArrayInGroups(arr, size) {
// Break it up.
var result = [];
for(var i = 0;i < arr.length; i++){
result.push(arr.slice(0, size));
}
return result;
}
chunkArrayInGroups([0, 1, 2, 3, 4, 5], 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/63.0.3239.132 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/chunky-monkey