Basic HTML version of Foils prepared 3 March 99

Foil 121 How to define Objects in JavaScript

From Overview of JavaScript I -- Basic Web Scripting Language CPS616 Technologies of the Information Age -- Spring Semester 99. by Geoffrey C. Fox (Tom Scavo)


1 We can use constructors described later but simplest way is:
2 newobject ={};
3 newobject.car = "honda";
4 newobject.wheels = 4;
5 newobject.color = "red";
6 Or newobject={car:"honda",wheels:4,color:"red"};
7 Or newobject = new Array();
8 newobject["car"] = "honda"; // etc.
9 This allows an "associative array"

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 Wed Mar 3 1999