Last active
June 3, 2017 14:10
-
-
Save maurobringolf/ba0ba9b08c72751d0c678dbdfe56f1bb 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 filter(arr, fn) { | |
return arr.reduce((acc, item) => fn(item) ? […acc, item] : acc, []) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment