HTML and CSS Reference
The book constructor function is defined with its properties.
The book object is described with three properties: title , author , and publisher .
The book object's property is assigned the name of a function. This property will
serve as a method for the object.
A function called show is defined.
The with keyword will allow you to reference the properties of the object without
using the name of the object and the dot or the this keyword. (See “The Math Ob-
ject” on page 241 in Chapter 9.)
A variable called info is assigned the property values of a book object. The with
keyword allows you to specify the property name without a reference to the object
(and dot) preceding it.
The alert box displays the properties for a book object.
The constructor function is called and returns an instance of a new book object
called childbook .
The constructor function is called and returns an instance of another book object
called adultbook .
The show() method is called for the childbook object (see Figure 8.10).
The show() method is called for the adultbook object (see Figure 8.11).
Figure 8.10 The childbook object and its properties.