Skip to content

Instantly share code, notes, and snippets.

@granmoe
Last active April 16, 2018 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save granmoe/fcae1152dd1bfda9e59c97d1fbd0a6e7 to your computer and use it in GitHub Desktop.
Save granmoe/fcae1152dd1bfda9e59c97d1fbd0a6e7 to your computer and use it in GitHub Desktop.
const mapFunction = func => reduce((accum, current) => [...accum, func(current)], [])
const double = mapFunction(x => x * 2)
double([1,2,3])
// returns [2, 4, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment