Tell us what’s happening:
I have been stuck on this exercise for a while and can’t seem to wrap my head around how it works. Here’s my code so far.
Your code so far
function chunkArrayInGroups(arr, size) {
let newArray = [];
for(let i = 0; i < arr.length; i++){
let slice = arr.slice(0, size);
let slice2 = arr.slice(size);
newArray.push(slice, slice2);
}
return newArray;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
.
Challenge: Chunky Monkey
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey