Chunky Monkey broken

Chunky Monkey broken
0

#1

Tell us what’s happening:
Why is this not working. works on codepen. let me pass.

Your code so far


function chunkArrayInGroups(arr, num) {
arr1=[];
  for (var i= 0; i<arr.length; i+=num){
arr1.push(arr.slice(i,num+i));
  }
 return arr1;
}
chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4);

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey


#2

all you are missing the keyword ‘var’ infront of arr1 to declare it in the local scope of the function. Then your code will pass.