The problem was to write a function that splits an array (first argument) into groups the length of `size` (second argument) and returns them as a two-dimensional array.

My code is

``````function chunkArrayInGroups(arr, size) {
let newArray = [];
for(let i = 0; i < arr.length; i += size){
newArray.push([arr.slice(i, i + size)]);
}
return newArray;
}
``````

I checked on the console and it was correct somehow. I can’t see where I went wrong. Please help

What do the failing tests say?

The results were

``````// running tests
chunkArrayInGroups(["a", "b", "c", "d"], 2) should return [["a", "b"], ["c", "d"]].
chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3) should return [[0, 1, 2], [3, 4, 5]].
chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].
chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].
chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3) should return [[0, 1, 2], [3, 4, 5], [6]].
chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4) should return [[0, 1, 2, 3], [4, 5, 6, 7], [8]].
chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2) should return [[0, 1], [2, 3], [4, 5], [6, 7], [8]].
// tests completed
``````

Run you code here

If you look, you’ll see that you’ve put your “chunks” into a 2d array, so the end result is a 3d array.

Thank you very much!!!

Got very addicted to destructuring, did’nt notice the return type of slice method hahahaha