Skip to content

Instantly share code, notes, and snippets.

@Lobstrosity
Created October 30, 2010 21:05
Show Gist options
  • Select an option

  • Save Lobstrosity/655744 to your computer and use it in GitHub Desktop.

Select an option

Save Lobstrosity/655744 to your computer and use it in GitHub Desktop.
(function(module, undefined) {
// Anything declared at this level is only accessible within this
// function. Efectively, they will be the module's private variables.
var _answer = 42;
// The module's public interface is then defined by declaring variables on
// the module variable that was passed in.
module.getAnswer = function(question) {
return _answer;
};
})(window.module = window.module || {});
module.getAnswer('Huh?');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment