HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 31 The New Way of Defining Arrays

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE
Addon
Write var area = new Array(); // Introduced in Netscape 3
and then you can set as described in Netscape Press book on JavaScript
area[0] = "Alabama";
area[1] = "Alabama";
area[2] = "Alaska"; // etc.
acode[0] = 205;
acode[1] = 334;
acode[2] = 907; // mappring area codes to states
area.length is automatically set as length of array ( 3 in this case)
Note you can set array elements to be objects to make Arrays of objects
e.g. listofmenus = new Array();
listofmenus[0] = new menuobject(1,'world');
worldmenu = listofmenus[0]; // A synonym



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 Feb 19 1997