Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gilesbradshaw
Last active December 1, 2017 11:16
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 gilesbradshaw/30b44679d5f2ae3d0bdafda74766d171 to your computer and use it in GitHub Desktop.
Save gilesbradshaw/30b44679d5f2ae3d0bdafda74766d171 to your computer and use it in GitHub Desktop.
function map(func) {
return this.reduce(
(acc, val) => [
...acc
func(val),
],
[],
);
}
[1, 2, 3]::map(x => x +1)
/*
[2,3,4]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment