An object representing the arguments to the currently executing function, and the functions that called it.
[function.]arguments[n]
You cannot explicitly create an arguments object. The arguments object only becomes available when a function begins execution. The arguments object of the function is not an array, but the individual arguments are accessed the same way array elements are accessed. The index n is actually a reference to one of the 0�n properties of the arguments object.
The following example illustrates the use of the arguments object.
function ArgTest(a, b){ var i, s = "The ArgTest function expected "; var numargs = arguments.length; //Get number of arguments passed. var expargs = ArgTest.length; //Get number of arguments expected. if (expargs < 2) s += expargs + " argument. "; else s += expargs + " arguments. "; if (numargs < 2) s += numargs + " was passed."; else s += numargs + " were passed."; s += "\n\n" for (i =0 ; i < numargs; i++){ //Get argument contents. s += " Arg " + i + " = " +arguments[
i
]
+ "\n"; } return(s); //Return list of arguments. }