Created
April 11, 2015 19:19
-
-
Save IPRIT/8625fbc68858129d47b2 to your computer and use it in GitHub Desktop.
Map with reduce
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
| module.exports = function map(arr, fn) { | |
| return arr.reduce(function(acc, item, index, arr) { | |
| return acc.concat(fn(item, index, arr)); | |
| }, []); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment