Slasher Flick error even though my code is right

Tell us what’s happening:

Is not that answer right? I am getting an error

Your code so far

var newArr=[];
function slasher(arr, howMany) {
  if(howMany>arr.length){
    return [];
  }
  for(var i=howMany; i<arr.length;i++){
    newArr[i-howMany]=arr[i];
  }
  arr=newArr;
  return arr;
}

slasher(["burgers", "fries", "shake"], 1);

Your browser information:

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

Link to the challenge:
https://www.freecodecamp.org/challenges/slasher-flick

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

Your code is essentially right, it’s just that you made newArr a global variable so it is getting reused for each test, the array getting bigger and bigger. Put it inside the function (so it gets recreated each time) and it should pass.