MCPcopy Create free account
hub / github.com/Faheem-Khan97/javascript-coding-problems-with-theory / sum

Function sum

currying.js:29–37  ·  view source on GitHub ↗
(a)

Source from the content-addressed store, hash-verified

27*/
28
29function sum(a){
30 return function curried(b){
31 if(!b){
32 return a;
33 }
34 return sum(a+b)
35
36 }
37}
38
39console.log(sum(1)(2)(3)(4)()); // 10
40

Callers 2

currying.jsFile · 0.70
curryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected