Created
October 25, 2010 19:35
-
-
Save bryanroth/645573 to your computer and use it in GitHub Desktop.
Closure
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 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