Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2015 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/d8da9f54856cebe0561b to your computer and use it in GitHub Desktop.
Save anonymous/d8da9f54856cebe0561b to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mattnwa 's solution for Bonfire: Slasher Flick
// 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