Skip to content

Instantly share code, notes, and snippets.

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