Skip to content

Instantly share code, notes, and snippets.

@joshkehn
Created August 30, 2011 01:37
Show Gist options
  • Save joshkehn/1179929 to your computer and use it in GitHub Desktop.
Save joshkehn/1179929 to your computer and use it in GitHub Desktop.
One-shot getters
// 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