Created
February 10, 2011 21:40
-
-
Save CrabDude/821403 to your computer and use it in GitHub Desktop.
Crockford's "Private Members in JavaScript"
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
// Public | |
function Constructor(...) { | |
this.membername = value; | |
} | |
Constructor.prototype.membername = value; | |
// Private | |
function Constructor(...) { | |
var that = this; | |
var membername = value; | |
function membername(...) {...} | |
} | |
// Privileged | |
function Constructor(...) { | |
this.membername = function (...) {...}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment