Created
November 1, 2011 19:31
-
-
Save matthewhudson/1331649 to your computer and use it in GitHub Desktop.
Best-practive JavaScript class: "that" is public, "my" is private to the object.
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 constructor = function (spec, my) { | |
var that = {}; | |
var my = my || {}; | |
// This function is private. | |
my.privateFunction = function() { | |
return true; | |
}; | |
// This function is public. | |
that.publicFunction = function() { | |
return true; | |
}; | |
return that; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment