23. create a sum()

JavaScript
Is this helpful ?

from all members: - accepted / - tried

Create a sum(), which makes following possible

const sum1 = sum(1)
sum1(2) == 3 // true
sum1(3) == 4 // true
sum(1)(2)(3) == 6 // true
sum(5)(-1)(2) == 6 // true

Let's try to solve this problem within 5 mintues.

Discuss(20)