Created
June 1, 2011 04:58
-
-
Save JayDouglass/1001808 to your computer and use it in GitHub Desktop.
Information hiding in JavaScript, private instance variables and methods
This file contains hidden or 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
function ASDFClass() { | |
var self = this; // used when you want to reference an instance of this object from private methods | |
this.PublicIVar = "asdafd"; | |
var privateIVar = "encapsulated"; | |
function PrivateFunction() { | |
} | |
this.PublicFunction = function () { | |
}; | |
} | |
var instance = new ASDFClass(); | |
instance.PublicFunction(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment