-
-
Save bryanmaina/30f7ef78a6572b8892a4 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/kobibr '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: @kobibr | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick?solution=function%20slasher(arr%2C%20howMany)%20%7B%0A%20%20return%20arr.splice(howMany-arr.length%2Carr.length-howMany)%3B%0A%7D%0A%0Aslasher(%5B1%2C%202%2C%203%5D%2C%202)%3B%0A | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function slasher(arr, howMany) { | |
return arr.splice(howMany-arr.length,arr.length-howMany); | |
} | |
slasher([1, 2, 3], 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment