HELP! * GREY=local LOCAL HTML version of Foils prepared 26 February 1996

Foil 21 The MakeArray Function and Arrays of Objects - I

From CPS616 Lectures on JavaScript CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. by Geoffrey C. Fox * See also color IMAGE

Somewhat peculiarly, one can refer to properties of any object in an array notation. Namely:
cps616[0]; is same as cps616.displayno;
cps616[4]; is same as cps616.indexpointer;
This feature can be used to define objects that act just like arrays: set magic function
function MakeArray(size) {
this.length = size;
for( var i=1; i<=size; i++ ) {
this[i]= 0; }
}



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 Tue Feb 18 1997