Chapter 3, Variables and Data Types, explained that objects are one
of the fundamental data types in JavaScript. They are also one of
the most important. This chapter describes JavaScript objects in
detail. Basic usage of objects, described in the first section
below, is straightforward, but as we'll see in later sections,
objects have more complex uses and behaviors.

An object is a data type that contains named
pieces of data. Each named datum is called a
property. Each property has a name, and the
object associates a value with each property name. A property
value may be of any type. In effect, the properties of an object
are variables within the "name space" created by the object.

You normally use the . operator to access the
value of an object's properties. The value on the left of the
. should be a reference to an object (usually
just the name of the variable that contains the object
reference). The value on the right of the .
should be the name of the property. This must be an identifier,
not a string or an expression. For example, you refer to the
property p in object o
with o.p. Or, you refer to the property
document in the object
parent with
parent.document. The .
operator is used for both reading and writing object properties.
For example:

// Read a property value:
w = image.width;
// Set a property value:
window.location = "http://my.isp.com/my_home_page/index.html";
// Read one property and set it in another property
image.src = parent.frames[1].location

If you attempt to read the value of a property that does not
exist--i.e., has never had a value assigned to it--you
will retrieve the special JavaScript undefined value (which was
introduced in Chapter 3, Variables and Data Types).

Once a property has been defined in an object, however, there is
no way to undefine it. You may set the value of a property to
the special undefined value, by assigning the value of an
undefined property, but this just changes the value of the
property without actually undefining it. You can demonstrate
that the property still exists by using a
for/in loop to print out the name of all
defined properties: