In a function, the identifier arguments references a special attribute of the arguments object. You can obtain the parameter values passed to the function by number (rather than name.
1. arguments
An array corresponding to the arguments passed to a function.
In a function, the identifier arguments references a special attribute of the arguments object. You can obtain the parameter values passed to the function by number (rather than name.
For example, (used in prototype. js ):
The Code is as follows:
Function $ (){
Var elements = new Array ();
For (var I = 0; I <arguments. length; I ++ ){
Var element = arguments [I];
If (typeof element = 'string ')
Element = document. getElementById (element );
If (arguments. length = 1)
Return element;
Elements. push (element );
}
Return elements;
}
The Argument object also defines the callee attribute (no matter here ).