Last active
August 31, 2017 15:21
-
-
Save maurobringolf/56e3ac2f43258511450caacbc66d1d9a to your computer and use it in GitHub Desktop.
Created for this post: https://maurobringolf.ch/2017/06/implementing-map-filter-and-find-with-reduce-in-javascript/
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
function find(arr, fn) { | |
return arr.reduce((acc, item) => fn(item) ? acc || item : acc, undefined) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment