Fun exercise: sum of numbers through infinite currying in JS.
There’s a fun question (depending on you definition of fun, of course 😆). How do you write function sum, so that the following is true?
sum(1) == 1;//true
sum(1)(2) == 3;//true
sum(1)(4)(1) ==…