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 …

JavaScript Encapsulation: Privacy and Data Hiding Read more »

JavaScript is a prototypal object-oriented language, which means objects can inherit directly other objects. This is in contrast with the classical languages such as Java, where a subclass inherits from a superclass, and objects are instances of classes. However, the …

JavaScript Inheritance: Pseudoclassical vs. Prototypal Read more »