[SOLVED] Chunky Monkey challenge clarification

Tell us what’s happening:
I don’t seem to know what is wrong with my code. I would appreciate any enlightenment .

Your code so far

function chunkArrayInGroups(arr, size) {
  // Break it up.
  var newArray = [];
  for(var i=0; i< arr.length; i=i+size){
    if(size <= arr.length){
      var chunk = arr.slice(i,size);
      newArray.push(chunk);
    }
    
  }
  return newArray;
}

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

Your browser information:

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

Link to the challenge:

Take a look at the docs for .slice(). You’re using it a bit incorrectly.

1 Like

ok, thanks. will look up the documentation again

Thanks so much, you reply did help. I was able to scale through this challenge in no time

1 Like