Created
December 3, 2015 21:10
-
-
Save anonymous/6ba5f3e58b0a7c780470 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/dbess1 '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: @dbess1 | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function slasher(arr, howMany) { | |
if(howMany < arr.length){ | |
var chop = arr.splice(0, howMany); | |
return arr; | |
} | |
else if(howMany > arr.length){ | |
return []; | |
} | |
} | |
slasher([1, 2, 3], 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment