23. create a sum()

JavaScript

easy  - 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

What is time & space complexity of your approach?

(76)