I need a js sum function to work like this:
sum(1)(2) = 3 sum(1)(2)(3) = 6 sum(1)(2)(3)(4) = 10 etc.
I heard it can\'t be done. But heard
Another slightly shorter approach:
const sum = a => b => b? sum(a + b) : a;
Usable as:
console.log( sum(1)(2)(), sum(3)(4)(5)() );