Chunky Monkey // For some reason I can' t run it

Chunky Monkey // For some reason I can' t run it
0.0 0

#1

Tell us what’s happening:

Your code so far


function chunkArrayInGroups(arr, size) {

  var temp = [];
  var result = [];

  for (var a = 0; a < arr.length; a++) {
    if (a % size !== size - 1)
      temp.push(arr[a]);
    else {
      temp.push(arr[a]);
      result.push(temp);
      temp = [];
    }
  }

Your browser information:

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

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


#2

2 things.

  1. you are missing a closing brace }
    • look at the FCC editor and you should see a red squiggly line. Whenever you see that, there is a syntax error. Hover over it to see what it expects.
    • keep in mind that sometimes the error actually happens a few lines before the error shows.
  2. you are not returning anything from your function