Forked from dtipson/Partially applied reduce with arrow functions.js
Created
March 29, 2018 01:23
-
-
Save phpsmarter/a9234d8ae47ca9746c963b406dcf9348 to your computer and use it in GitHub Desktop.
Partially applied reduce with arrow functions.js
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
var reduce = fn => (Arr, acc) => Arr.reduce(fn, acc); | |
var add = reduce((acc,x)=>acc+x); | |
add([1,2,3],0);// -> 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment