Tell us what’s happening:
Hello everyone, I just wanted to ask whether my solution to the “Chunky Monkey” problem is acceptable. This code passes all the tests but the loop used removes all the elements in the original array, leaving it empty.
**Your code so far**
function chunkArrayInGroups(arr, size) {
let newArr = [];
for (let i = 0; i < arr.length;){
newArr.push(arr.splice(i,size));
}
return newArr;
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
Challenge: Chunky Monkey
Link to the challenge: