Chapter 3. Understanding Objects

Even though there are a number of builtin reference types in JavaScript, you will most likely create your own objects fairly frequently. As you do so, keep in mind that objects in JavaScript are dynamic, meaning that they can change at any point during code execution. Whereas class-based languages lock down objects based on a class definition, JavaScript objects have no such restrictions.

A large part of JavaScript programming is managing those objects, which is why understanding how objects work is key to understanding JavaScript as a whole. This is discussed in more detail later in this chapter.

Defining Properties

Recall from Chapter 1 that there are two basic ways to create your own objects: using the Object

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.