Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bonfire: Finders Keepers
- // Author: @priyesht
- // Learn to Code at Free Code Camp (www.freecodecamp.com)
- function find(arr, func) {
- var num;
- num = arr.filter(func);
- return num[0];
- }
- find([1,3,5,8,9,10], function(num){ return num % 2 === 0; });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement