Chunky Monkey not clear what's wrong

Hi there,

I’ve a problem with the chunky monkey challenge.
My code seems to give the right answer, but FCC doesn’t recognize it like that. I have to return a nested array: [[X, X], [X, X]]. In the console I cannot see the difference between a normal and a nested array, so I cannot see if that is the problem.

function chunkArrayInGroups(arr, size) {
  // Break it up.
  let newArr = [];
  let fullArr = [];
  let increasement = 0

  for (let i=0; i<arr.length; i+=size) {
  newArr.push(arr.slice(increasement, i+size));
  increasement = increasement + size;
  newArr = [];
    return fullArr;

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3);

Whats going on?

With the code you have, you can press F12 and go to the console. It should give you a better understanding of what’s happening. I’m guessing the freecodecamp doesn’t handle console.log() the same way as the browser itself.

Or convert your object (in this case your array) to a string:


1- Revise what slice() return
2- With your code, you can resolve it with less line and only one temporary array

Hope it help!