Chapter 8

Objects

Key Skills & Concepts

   Defining Objects

   Creating Objects

   Using Prototypes

   Object Statements

   Understanding Predefined JavaScript Objects

Objects provide you with even more flexibility in your scripts. They can be used as another way to store data, or can be used to create reusable structures. In this chapter, you will learn what JavaScript objects are, how to create objects, and how to make use of some of the predefined objects.

Defining Objects

Since JavaScript is a prototype-based language, objects work differently than they do in class-based languages.

JavaScript objects are basically a collection of properties and values, what is called a hash table in programming. It is the values that give JavaScript ...

Get JavaScript: A Beginner's Guide, Fifth Edition, 5th 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.