Chunky Monkey help - 09/05/22

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:

I think it just depends on the situation. Will you need arr later? If you don’t then this works just fine. If you needed to save the original then you’d have to look for another way to it.