September 2015
Intermediate to advanced
92 pages
1h 30m
English
CHAPTER 9
![]()
Objects
An object is a collection of named values known as properties. Properties can be either variables that hold the state of the object, or functions that define what the object can do. The appeal of objects is that they provide functionality while hiding their inner workings. All you need to know is what an object can do for you, not how it does it.
Object Properties
An empty object can be created using the new directive in the following explicit manner.
var box = new Object();
Properties for an object are created automatically when they are assigned to, using either the dot notation or the array notation.
box.x = 2;box["y"] = 3; ...
Read now
Unlock full access