Chunky Monkey js challenge

Chunky Monkey js challenge
0

#1

Hi, what should I do after this for Chunky Monkey Challenge


function chunkArrayInGroups(arr, size) {
  var length = arr.length;  //length of the given array
  var left = length%size;  //number of objects left in the array after forming the blocks of the given size
  var blocks = (length-left)/size;  //number of blocks formed
  var removed;  //the objects removed after forming the blocks
  var smallArray=arr;
  for (i=1;i<=left;i++){
    removed = smallArray.pop(); //To give the array of length, which is a multiple of size
  }
}

chunkArrayInGroups(["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"], 3);

Thanks.


#2

Instead of increment i, add size to it.
Then inside the loop, use arr.slice() to get parts of the given size.
Store those parts in array and return it after loop.