- 
      
- 
        Save abhisheksliam/b13a69dc484ef13ce79880d2225a988a to your computer and use it in GitHub Desktop. 
Revisions
- 
        getify renamed this gist Sep 4, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewingFile renamed without changes.
- 
        getify revised this gist Sep 4, 2015 . 2 changed files with 12 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // 96 characters, from @sainaen, @rreverser, others: function add(a,s){return(a=add.bind(0,s=[].join.call(arguments,'+'))).toString=eval.bind(0,s),a} add() + 0; // NaN add(1) + 0; // 1 add(1,2) + 0; // 3 add(1)(2) + 0; // 3 add(1,2)(3) + 0; // 6 add()()(1,2)()(3) + 0; // 6 add(1,2)(3)(4,5)(6) + 0; // 21 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,4 +21,4 @@ add(1,2) + 0; // 3 add(1)(2) + 0; // 3 add(1,2)(3) + 0; // 6 add()()(1,2)()(3) + 0; // 6 add(1,2)(3)(4,5)(6) + 0; // 21 
- 
        getify revised this gist Sep 4, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ function add() { sum += Number(arguments[i]); } return add; } add.valueOf = function valueOf(){ return sum; }; 
- 
        getify revised this gist Sep 4, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function add() { function add() { for (var i=0; i<arguments.length; i++) { sum += Number(arguments[i]); } return add; }; 
- 
        getify revised this gist Sep 4, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function add() { function add() { for (var i=0; i<arguments.length; i++) { sum += +arguments[i]; } return add; }; 
- 
        getify revised this gist Sep 4, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ function add() { var sum = 0; function add() { for (var i=0; i<arguments.length; i++) { sum += arguments[i]; } return add; }; add.valueOf = function valueOf(){ return sum; }; return add.apply(null,arguments); 
- 
        getify created this gist Sep 4, 2015 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ function add() { var sum = 0; function add(){ for (var i=0; i<arguments.length; i++) { sum += arguments[i]; } return add; }; add.valueOf = function(){ return sum; }; return add.apply(null,arguments); } // ... add() + 0; // 0 add(1) + 0; // 1 add(1,2) + 0; // 3 add(1)(2) + 0; // 3 add(1,2)(3) + 0; // 6 add()()(1,2)()(3) + 0; // 6 add(1,2)(3)(4,5)(6) + 0; // 21