Skip to content

Instantly share code, notes, and snippets.

@minsooshin
Created November 25, 2015 02:02
Show Gist options
  • Save minsooshin/173bc5cb7db54dcdcf74 to your computer and use it in GitHub Desktop.
Save minsooshin/173bc5cb7db54dcdcf74 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/minsooshin 's solution for Bonfire: Finders Keepers
// Bonfire: Finders Keepers
// Author: @minsooshin
// Challenge: http://www.freecodecamp.com/challenges/bonfire-finders-keepers
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function find(arr, func) {
var num = 0;
num = arr.filter(function(val) {
return func(val);
});
return num[0];
}
find([1, 2, 3, 4], function(num){ return num % 2 === 0; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment