Chapter 8Building and Extending Objects

Creating Instances

We introduced the concepts of object-oriented programming in Chapter 4, so you should already realize that not only does JavaScript support only limited object-oriented programming, but that some terms used here might not be used the same way they are in other languages (such as C++, C#, or Java). In JavaScript, an object is the template from which you make instances. In purely object-oriented languages, an object is the instance made from a class. If you have experience in true object-oriented languages, don’t let this terminology throw you off.

For example, suppose you have defined an employee object that includes some methods and properties of an employee, such as his or her social ...

Get Advanced Javascript, 3rd Edition 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.