Code for add(1)(2)...(n)()
Code for add(1)(2)...(n)()
function add(x) {return function (y) {if (typeof y !== "undefined") {x = x + y;return arguments.callee;} else {return x;}};}
Alternative to arguments.callee
function add(x) {return function (y) {if (typeof y !== "undefined") {x = x + y;return add(x);} else {return x;}};}
Alternative Syntax
const add = (x) => (y) => typeof y === "undefined" ? x : add(x + y);