Basic HTML version of Foils prepared 23 June 1997

Foil 32 Arrays in JavaScript - II

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

A set of Array examples -- old format for Foil 32
1 This is the old way of defining arrays and the only way allowed in Navigator 2:
2 function MakeArray(size) {
3 this.length = size;
4 for( var i = 1; i <= size; i++ ) {
  • this[i] = 0;
5 }
6 }
7 This gives arrays where you must predefine a size (a problem) and where arrays count from 1 not 0 (an artifact of MakeArray setting this.length = size at start not end of function). The latter "feature" could lead to great joy for Fortran programmers!

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