Basic HTML version of Foils prepared 16 June 98

Foil 101 User-defined Objects

From Overview of Advanced JavaScript -- Web Scripting Language CPS616 Technologies of the Information Age -- Spring Semester 98. by Tom Scavo,Geoffrey C. Fox

A User-defined Object
1 Objects are defined with the function statement. The following Circle object, for example, has property r: function Circle( r ) { this.r = ( r > 0 ) ? r : 0; }
2 The this keyword permits this function to be used as a constructor: var c = new Circle( 2.0 ); var area = Math.PI * c.r * c.r;

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998