Skip to content

Instantly share code, notes, and snippets.

@rubenribeiro
Forked from anonymous/bonfire-drop-it.js
Created December 12, 2015 04:23
Show Gist options
  • Save rubenribeiro/fff65201a2e6e6abf1fc to your computer and use it in GitHub Desktop.
Save rubenribeiro/fff65201a2e6e6abf1fc to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/dannycoder 's solution for Bonfire: Drop it
// 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