Created
August 30, 2011 01:37
-
-
Save joshkehn/1179929 to your computer and use it in GitHub Desktop.
One-shot getters
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
// One-shot get function | |
function port (number) | |
{ | |
port = function () { | |
return number; | |
} | |
} | |
port(8080); | |
// This won't do anything | |
port(8081); | |
console.log('Listening on port ' + port()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment