HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 34 The arguments Array in JavaScript

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE

function anyoldname(x1,x2) {
var argv = anyoldname.arguments;
n = anyoldname.arguments.length; // number of arguments -- same as argv.length
var y1 = anyoldname.arguments[0]; // y1 is same as this.x1 or argv[0]
var yn = anyoldname.arguments[n-1]; // last argument -- same as argv[n-1]
var wherefrom = anyoldname.caller; // use inside function to find where called from
}
This allows one to find number of arguments when called and process functions with variable number of arguments
Netscape documentation says this is a property of Functions (interpreted functions) but appears to work on both!



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 Feb 19 1997