Say we have
var i = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
and want to reduce() it like
var plus = function(a, b)
{
return a + b;
};
var s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
.reduce(plus);
console.log(s);
Now, I want to compose reduce() function itself from map() function.
How would you do that? What is the smartest way?
thanks!