Implement the Chunky Monkey Algorithm - Implement the Chunky Monkey Algorithm

Tell us what’s happening:

This code seems fool-proof to me but it’s not working, can I get help please?

Your code so far

const chuckyArrayInGroups = (arr, num) => {
  let result = [];
  for(let i = 0; i < arr.length; i += num){
    result.push(arr.slice(i, i + num));
  }
  return result;
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0

Challenge Information:

Implement the Chunky Monkey Algorithm - Implement the Chunky Monkey Algorithm

did you try adding one of the function calls from the tests to your editor?

like console.log(chunkArrayInGroups(["a", "b", "c", "d"], 2))?

Ha! It looked correct to me, too; I couldn’t see what the problem was, so I tried your code. When you take @ILM ‘s advice you’ll laugh at what the error is.