Basic HTML version of Foils prepared 23 June 1997

Foil 33 Arrays in JavaScript - III

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo

Arrays Example
1 One can easily define and use multidimensional arrays:
  • MenuArray[0].options[0] = 'Admin';
  • MenuArray[0].options[1] = 'FoilWorld'; // etc.
2 Arrays (in NN 3.0) have some interesting methods:
  • myArray.sort(sortMethod)
  • returns an array sorted according to the optional sortMethod (a user-defined, boolean function comparing two elements)
  • myArray.join(separator)
  • returns a string of elements separated by the character separator
  • myArray.reverse()
  • reverses the order of the elements in the array
3 myArray = new Array(InitSize,val0,val1,...);
4 specifies an initial size and initial values of the array. The arguments are optional and undefined initial values are set to null.

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 Apr 1 1998