Created
January 19, 2017 15:25
-
-
Save agentreno/92be78c647dbd10c6f53d833ceb9a36c to your computer and use it in GitHub Desktop.
Revealing module pattern with instance variables
This file contains 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
var mymodule = (function() { | |
function init() { | |
this.first = undefined; | |
this.second = 'blah'; | |
this.third = []; | |
} | |
var getFirst = function(){ | |
console.log(this.first); | |
}; | |
var getSecond = function(){ | |
console.log(this.second); | |
}; | |
var getThird = function(){ | |
console.log(this.third); | |
}; | |
return { | |
first: null, | |
second: null, | |
third: null, | |
init: init, | |
getFirst: getFirst, | |
getSecond: getSecond, | |
getThird: getThird | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment