Tell us what’s happening:
So, in this code i am pushing in sub array’s into my array variable “array” and than filling it with as many elements from the passed in arr argument as size tells me to. Everything is working fine except the first for loop is only running twice instead of running the length of arr. What is the problem here?
Your code so far
var array = [];
for (var i = 0; i < arr.length; i++){
array.push([]);
//pushes a sub-array into the array
for (var j = 0; j < size; j++){
array[i][j] = arr.shift();
//shifts the first element into the array, this process is repeated based on the 'size' arguement passed in
}
}
return array;
}
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/60.0.3112.90 Safari/537.36```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/chunky-monkey