Slasher Flick: Test Isn't Satisfied

Slasher Flick: Test Isn't Satisfied
0.0 0

#1

I’m having trouble with my code for the JS algorithm challenge “Slasher Flick.” Here’s my code:

function slasher(arr, howMany) {
    // it doesn't always pay to be first
var arrayRemain = arr.slice(howMany);
if (arr.length < howMany) {

    return "[]";

} else if (arr.length >= howMany) {

    return arrayRemain;
  }
}

  slasher([1, 2, 3], 9);

When howMany is larger than the length of arr, it returns [] like the test says it should. But when I run the code, it says that [] isn’t being returned like it should for this scenario.

CloudApp

Any help would be appreciated! I have a feeling I’m supposed to have a different way to return [] but I don’t know what that would be.


#2

You are returning a string "[]" rather than an empty array [].


#3

Oh, gosh :upside_down_face: . Thank you!