Advertisement
Guest User

Untitled

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