Skip to content

Instantly share code, notes, and snippets.

@bryanroth
Created October 25, 2010 19:35
Show Gist options
  • Save bryanroth/645573 to your computer and use it in GitHub Desktop.
Save bryanroth/645573 to your computer and use it in GitHub Desktop.
Closure
var myObject = function () {
var value = 0;
return {
increment: function (inc) {
value += typeof inc === 'number' ? inc : 1;
},
getValue: function () {
return value;
}
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment