var add = function (a) {return function (b) {return function (c) {return a+b+c; }; };}; Add (1) (2) (3); 6
That's right! If Add (1) (2) (3) (4) Such 4 calls, then this certainly does not apply.
This is analogous to executing a function that returns the value of the function itself:
function add (x) { var sum = x; var tmp = function (y) { sum = sum + y; return tmp; }; tmp.toString = function () { return sum; }; return tmp;} Console.log (Add (1) (2) (3)); //6console.log (Add (1) (2) (3) (4));    //10
But after the completion of the calculation or return to the TMP function, so that we can not get the results of the calculation, we need the result is a calculated number then what to do, first of all to know JavaScript, print and add calculation, will call the ToString or valueof function, respectively, So we rewrite TMP's ToString and valueof methods, returning the value of sum;
JS implementation is similar to the general method of the Add (1) (2) (3) Invocation mode