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

Foil 20 More on Arrays -- Properties and Multidimensions

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 164.1 Addon
Note one can easily define and use multidimensional arrays as in syntax
  • listofmenus[0].options[0]='Admin';
  • var currentworld = 0;
  • listofmenus[currentworld].options[1]='FoilWorld'; // etc.
Arrays (the new ones!) have some interesting methods
  • MyArray.sort(sortmethod) returns list sorted in fashion determined by optional argument sortmethod (a user function comparing two elements)
  • MyArray.join(separator) returns a string of the MyArray elements separated by the character string separator
  • MyArray.reverse() reverses order in Array
MyArray = new Array(Initialsize,value0,value1, ...); // can specify an initialsize and initial values at the user's pleasure. These arguments are opitional and undefined initial values are set to null


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