Example programs for Part 9

Right click on the anchor and select 'Save Target As ...' to download the file.

Example using the Object() constructor and object literals, from sec. 9.1

The remaining examples are JavaScript files. Right click here to download an .html file you can use as a template for drivers for the JavaScript files (just change the value of the src attribute).

Example of a constructor without parameters, from sec. 9.3

Example of a constructor with parameters and defaults, from sec. 9.4

Defining the Circle prototype, from sec. 9.5.2

Defining the complex-number prototype, from sec. 9.5.5

Example of inheriting property values from a prototype, from sec. 9.6

Example that constructs indices into an an associative array, from sec. 9.7

The portfolio example, from sec. 9.7