Created
November 25, 2015 02:02
-
-
Save minsooshin/173bc5cb7db54dcdcf74 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/minsooshin 's solution for Bonfire: Finders Keepers
This file contains hidden or 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: 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