O'Reilly logo

The JavaScript Programming Language by John David Dionisio, Ray Toal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

chapter 4

Objects

JavaScript values come in two flavors: simple values (numbers, Booleans, strings, null, and undefined) and objects. This chapter shows how to define and use objects.

4.1 Object Notation

In JavaScript, objects have properties, and properties have values. Property values may be objects as well, allowing complex structures to be defined. An object literal is an expression defining a new object; several examples follow.

images

images

After defining an object, you may access its properties with either a dot or square brackets.

Property names can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required