-
-
Save rubenribeiro/fff65201a2e6e6abf1fc to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/dannycoder 's solution for Bonfire: Drop it
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: Drop it | |
// Author: @dannycoder | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-drop-it | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function drop(arr, func) { | |
// Drop them elements. | |
while(!func(arr[0])){ | |
arr.shift(); | |
} | |
return arr; | |
} | |
drop([1, 2, 3], function(n) {return n < 3; }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment