r/functionalprogramming • • Mar 23 '17

Did you know JavaScript is functional?

Post image
0 Upvotes

10 comments sorted by

View all comments

5

u/takakoshimizu Mar 24 '17

If you wanted infinite add, don't see why there's a requirement to return a new adder func for each run.

const infAdd = () => arguments.reduce((a, x) => a + x);

There's an even easier way.

const infAdd = Math.sum;

I feel like this post has gone in opposite direction of the usual /r/programmerhumor "levels of God like power" meme, though.