Write a function named currySum that will be used to add numbers.
In this exercise we're not gonna tell you how the function should look like. Instead, you need to figure this out by looking at the examples.
console.log(currySum()); // 0
console.log(currySum(1)()); // 1
console.log(currySum(1)(2)()); // 3
console.log(currySum(1)(2)(3)()); // 6
console.log(currySum(11)(10)(9)(-5)(44)(107)(109)()); // 285
Unlock all functions
The first 10 functions are free. Get lifetime access to all 100 with a one-time payment — no subscription.
Upgrade to Pro