/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Public */ function Constructor(...) { this.membername = value; } Constructor.prototype.membername = value; /* Private */ function Constructor(...) { var that = this; var membername = value; function membername(...) {...} } Note: The function statement function membername(...) {...} is shorthand for var membername = function membername(...) {...}; /* Privileged */ function Constructor(...) { this.membername = function (...) {...}; }
URL: http://www.crockford.com/javascript/private.html