Skip to content

Instantly share code, notes, and snippets.

@dasibre
Created March 5, 2016 21:08
Show Gist options
  • Select an option

  • Save dasibre/6060b7f346932be9d735 to your computer and use it in GitHub Desktop.

Select an option

Save dasibre/6060b7f346932be9d735 to your computer and use it in GitHub Desktop.
javascript module pattern
var testModule = (function() {
var counter = 0;
return {
incrementCounter: function () {
return counter++;
},
resetCounter: function () {
console.log("counter value prior to reset: " + counter);
counter = 0;
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment