Objects and Dynamism

In this lesson, we'll get acquainted with objects and their usage in JavaScript. Let's begin! :)

In previous code examples you could already see that JavaScript works with primitive types, such as numbers or strings.

However, when you worked with the DOM in the previous chapter, you saw that the language works with objects representing the document loaded into the browser or a collection of objects that represent HTML elements.


Objects are the most important concept in the language.


Everything is either an object in JavaScript, or a primitive type’s instance that can work like an object.


Objects can have zero, one, or more properties with their associated values, and— wait for it! — they can be extended with properties dynamically at run-time.

The Listing below ...