Created
January 26, 2017 10:01
-
-
Save simonewebdesign/6578261e471a1bdf75483b8c68913581 to your computer and use it in GitHub Desktop.
JavaScript implementation of Array#map with Array#reduce
This file contains 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 arrayMap(arr, fn) { | |
return arr.reduce(function (prev, current) { | |
return prev.concat(fn(current)); | |
}, []); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment