Object Oriented JavaScript: the patterns for private/public <p>All-</p> <p>There is a classic pattern of implementing information hiding in Javascript as described by the great Douglas Crockford here:</p> <p><a href="http://javascript.crockford.com/private.html" rel="nofollow">http://javascript.crockford.com/private.html</a></p> <p>I am also aware of another one I demonstrate here: <a href="http://jsfiddle.net/TvsW6/4/" rel="nofollow">http://jsfiddle.net/TvsW6/4/</a></p> <p>And summarized as such:</p> <pre><code>function LogSystem(anotherPrivateVar) { //. . var _setting1; this.setting2; function _printLog(msg) { $("#" + _divId).append(msg + "&lt;br/&gt;"); }; return { printLog :function(msg) { console.log("PRINTING:" + msg); _printLog(msg); }, logSetting_pub: function() { this.printLog("PUB: Setting1 is: " + _setting1); this.printLog("PUB: Setting2 is: " + this.setting2); } //.. }; }; </code></pre> <h2>QUESTIONS</h2> <p>Are there any other patterns beside these two that implement public and private methods and members in JavaScript? And are there names for these two patterns? And do you have a preference for the two (or more!)</p> <p>Thank you so much for your help. I am finding that knowing advanced topics in raw JavaScript are rare skills and I'd like to have them!</p>