Basic HTML version of Foils prepared 23 June 1997

Foil 34 The arguments Array

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


function foo(x1, x2) {
// the arguments array:
var argv = foo.arguments;
// number of arguments (same as argv.length):
var n = foo.arguments.length;
// y1 is same as this.x1 or argv[0]:
var y1 = foo.arguments[0];
// the last argument (same as argv[n-1]):
var yn = foo.arguments[n-1];
// use inside function to determine caller:
var wherefrom = foo.caller;
}
This allows one to process functions with a variable number of arguments
The arguments array is a property of all user-defined functions and Function objects.



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