Blog Archives

JavaScript Encapsulation: Privacy and Data Hiding

JavaScript does not have syntax-level encapsulation. All properties of an object are visible. However, there do exist various patterns to ensure data encapsulation. Singletons and the Module Pattern The following code creates one singleton object using an object literal. JavaScript

Tagged with: , , ,
Posted in JavaScript, Web