Tell us what’s happening:
I have restarted this a few times but I can’t seem to past the tests.
if I do more than one test cases the results are combined into one big array.
Also, there are extra spaces before and after each array as shown in the screenshot.
Here is my code:
Your code so far
const newArray=[]; function chunkArrayInGroups(arr, num) { for (let i = 0; i < arr.length; i+=num) { newArray.push(arr.slice(i,i+num)); } console.log(newArray); return newArray; } chunkArrayInGroups(["a", "b", "c", "d"], 2) chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)
//[[0, 1], [2, 3], [4, 5], [6, 7], [8]]
### Your browser information:
User Agent is: <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36</code>
### Challenge Information:
Implement the Chunky Monkey Algorithm - Implement the Chunky Monkey Algorithm
https://www.freecodecamp.org/learn/full-stack-developer/lab-chunky-monkey/implement-the-chunky-monkey-algorithm