Skip to content

Instantly share code, notes, and snippets.

@boombang
Last active April 6, 2019 16:46
Show Gist options
  • Save boombang/d5422dbb05e1a89634fce6478349cdd0 to your computer and use it in GitHub Desktop.
Save boombang/d5422dbb05e1a89634fce6478349cdd0 to your computer and use it in GitHub Desktop.
var myRevealingModule = (function () {
var privateVar = "Ben Cherry";
var publicVar = "Hey there!";
function privateFunction() {
console.log( "Name:" + privateVar );
}
function publicSetName( strName ) {
privateVar = strName;
}
function publicGetName() {
privateFunction();
}
return {
setName: publicSetName,
greeting: publicVar,
getName: publicGetName
};
})();
myRevealingModule.setName( "Paul Kinlan" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment