Chunky Monkey Challenge Help

Chunky Monkey Challenge Help
0

#1

Tell us what’s happening:
I’m just seeking assistance in what I can do to fix my code to complete this challenge.

function chunkArrayInGroups(arr, size) {
  
  var mainArray = [];
  var iterate = size;
  
  for (var i = 0; i < arr.length; i += iterate) {
    var subArray = arr.slice(i, size);
    mainArray.push(subArray);
  }
  
  return mainArray;
}

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

Link to the challenge:


#2

I fixed only onde thing .-.

function chunkArrayInGroups(arr, size) {

var mainArray = [];
var iterate = size;

for (var i = 0; i < arr.length; i += iterate) {
var subArray = arr.slice(i, size + i); // Only forgot to put +i here.
mainArray.push(subArray);
}

return mainArray;
}