Skip to content

Instantly share code, notes, and snippets.

@premithk
Last active December 21, 2017 17:39
Show Gist options
  • Save premithk/f85ecbed1f10948817e199f3ba64c352 to your computer and use it in GitHub Desktop.
Save premithk/f85ecbed1f10948817e199f3ba64c352 to your computer and use it in GitHub Desktop.
const map_recursive = (map_function, array) =>
!array.length
? []
: [map_function(array[0])].concat(
map_recursive(map_function, array.slice(1))
);
map_recursive(x=>x+1, [1,2,3,4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment