Chapter 6. Object Patterns
JavaScript has many patterns for creating objects, and there’s usually more than one way to accomplish the same thing. You can define your own custom types or your own generic objects whenever you want. You can use inheritance to share behavior between objects, or you can employ other techniques, such as mixins. You can also take advantage of advanced JavaScript features to prevent an object’s structure from being modified. The patterns discussed in this chapter give you powerful ways of managing and creating objects, all based on your use cases.
Private and Privileged Members
All object properties in JavaScript are public, and there’s no explicit way to indicate that a property shouldn’t be accessed from outside a particular ...
Get The Principles of Object-Oriented JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.