Chunky Monkey correct answer not appearing as such

Chunky Monkey correct answer not appearing as such
0

#1

Tell us what’s happening:
i got the first result but it doesn’t say its correct

Your code so far

var chunk = [];
function chunkArrayInGroups(arr, size) {
  array = arr.slice(0, size);
  array2 = arr.slice(size);
  chunk.push(array);
  chunk.push(array2);
  return chunk;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36.

Link to the challenge:


#2

Your code contains global variables that are changed each time the function is run. This means that after each test completes, subsequent tests start with the new value. To fix this, make sure your function doesn’t change any global variables, and declare/assign variables within the function if they need to be changed.

Example:

var myGlobal = [1];
function returnGlobal(arg) {
  myGlobal.push(arg);
  return myGlobal;
} // unreliable - array gets longer each time the function is run

function returnLocal(arg) {
  var myLocal = [1];
  myLocal.push(arg);
  return myLocal;
} // reliable - always returns an array of length 2