Created
December 3, 2015 21:51
-
-
Save anonymous/d8da9f54856cebe0561b to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mattnwa 's solution for Bonfire: Slasher Flick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bonfire: Slasher Flick | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function slasher(arr, howMany) { | |
// it doesn't always pay to be first | |
if (howMany < 1) { | |
return arr; | |
} else { | |
return arr.splice(howMany, arr.length); | |
} | |
} | |
slasher([1, 2, 3], 2); | |
slasher([1, 2, 3], 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment