Core JavaScript 1.5 Reference:Global Objects:Function:arguments
From MDC
Deprecated
Contents |
[edit] Summary
An array-like object corresponding to the arguments passed to a function.
[edit] Description
Use the arguments object available within functions instead of Function.arguments.
[edit] Notes
In the case of recursion, i.e. if function f appears several times on the call stack, the value of f.arguments represents the arguments corresponding to the most recent invocation of the function.
[edit] Example
function f(n) { g(n-1) }
function g(n) {
print("before: " + g.arguments[0]);
if(n>0)
f(n);
print("after: " + g.arguments[0]);
}
f(2)
outputs:
before: 1 before: 0 after: 0 after: 1