Gets the arguments for the currently executing Function object.
Syntaxfunction.arguments
Examples
The following example illustrates the use of the arguments property:
function ArgTest(arg1, arg2){
var s = "";
s += "The individual arguments are: "
for (n = 0; n < arguments.length; n++){
s += ArgTest.arguments[n];
s += " ";
}
return(s);
}
document.write(ArgTest(1, 2, "hello"));
var s = "";
s += "The individual arguments are: "
for (n = 0; n < arguments.length; n++){
s += ArgTest.arguments[n];
s += " ";
}
return(s);
}
document.write(ArgTest(1, 2, "hello"));
Remarks
The function argument is the name of the currently executing function, and can be omitted.
This property allows a function to handle a variable number of arguments. The length property of the arguments object contains the number of arguments passed to the function. The individual arguments contained in the arguments object can be accessed in the same way array elements are accessed.
See also Other articles AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4