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.
After defining an object, you may access its properties with either a dot or square brackets.
Property names can ...
Get The JavaScript Programming Language 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.