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

Foil 19 The old MakeArray Function and Arrays of Object

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 279.3 Addon
This is the old way of defining arrays and only way allowed in Netscape 2.
You were asked to define a special function
function MakeArray(size) {
this.length = size;
for( var i=1; i<=size; i++ ) {
this[i]= 0; }
}
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!


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