Skip to content

Instantly share code, notes, and snippets.

@dbess1
Forked from anonymous/bonfire-slasher-flick.js
Created December 3, 2015 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbess1/05f9eedf3057b088a130 to your computer and use it in GitHub Desktop.
Save dbess1/05f9eedf3057b088a130 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/dbess1 's solution for Bonfire: Slasher Flick
// 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