(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?');