Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing
Example 13.1:
Creating Objects
This form displays all the properties for each object created. It uses the
dot notation as in object.property:
We created the object instance like this:
Then we used the new statement to create each object instance:
var product1 = new product("TimeSaver", "$23")
var product2 = new product("MoneySaver", "$11")
var product3 = new product("Time n'MoneySaver", "$99")
//==========================================================================
//-->
The object's properties are then displayed using the dot notation:
document.write(product1.name + " " + product1.price + "
")
document.write(product2.name + " " + product2.price + "
")
document.write(product3.name + " " + product3.price + "
")
Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing