phpsmarter
3/29/2018 - 1:23 AM

Partially applied reduce with arrow functions.js

Partially applied reduce with arrow functions.js

var reduce = fn => (Arr, acc) => Arr.reduce(fn, acc);

var add = reduce((acc,x)=>acc+x);

add([1,2,3],0);// -> 6