March 27, 2000 - The arguments Array
![]() |
March 27, 2000 The arguments Array Tips: March 2000
Yehuda Shiran, Ph.D.
|
arguments array holds the arguments the were passed to the function functionName when it was last called. Here is an example:
function foo() {
document.write(foo.arguments[2]);
}
foo(1, 2, 3, 4, 5);
foo();The output of the script is:
3
3
The second 3 is not associated with the second foo() call, but rather with the first one. Since the second foo() call has no arguments, the arguments from the first foo() call still occupy the arguments array.
See an example for using the arguments array in Column 59, IE 5.5's Stack Support.


Find a programming school near you