Created
January 26, 2013 10:19
-
-
Save lyuehh/4641542 to your computer and use it in GitHub Desktop.
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 characters
function add_1(x, y) { | |
return x + y; | |
} | |
console.log(add_1(1,2)); | |
function add(x, y) { | |
var oldx = x, oldy = y; | |
if(typeof y === 'undefined') { | |
return function(newy) { | |
return oldx + newy; | |
}; | |
} | |
return x + y; | |
} | |
console.log(add(1,2)); | |
console.log(add(1)(2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment