Basic Algorithm Chunky Monkey

Tell us what’s happening:
Describe your issue in detail here.

May I know why only the last case: chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2) should return [[0, 1], [2, 3], [4, 5], [6, 7], [8]] doesn’t work?

function chunkArrayInGroups(arr, size) {

let d =

for(let i = 0; i < arr.length; i += size) {

var b = arr.splice(0, size)

d.push(b)

console.log(d)

}

d.push(arr)

return d;
}

chunkArrayInGroups([“a”, “b”, “c”, “d”], 2);

  **Your code so far**

function chunkArrayInGroups(arr, size) {
var a = []
var b = []

a.push(arr)
console.log(a)

for (let i = 0; i < size; i++){
  b.push (a.slice(0, i + size))

  
   
 }



return b;
}

console.log(chunkArrayInGroups(["a", "b", "c", "d"], 2));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36

Challenge: Chunky Monkey

Link to the challenge:

At a guess, this first line isn’t doing what you might think. What do you intend there? And what exactly does this second line show?