let sumRecursive = function(a){
return function(b){
if(b){
return sumRecursive(a+b);
}
return a;
}
}
console.log(sumRecursive(1)(2)(3)());
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter