HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 21 February 97

Foil 18 The New Way of Defining Arrays

From Feb 17/19 Delivered Lecture for Course CPS616 -- aJavaScript Language Objects and Frames CPS616 spring 1997 -- Feb 17 and 19 1997. by Geoffrey Fox * Important Information in IMAGE
Secs 758.8 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 Fri Feb 21 1997