arguments is a parameter of the currently executing function, which saves the parameters of the current call of the function.
Usage: function.arguments[i].
Where function. is optional and is the name of the function currently being executed.
arguments cannot be created. They are parameters of the function itself and can only be used when the function starts executing.
Although the usage of arguments is very similar to an array, it is not an array.
Below, use an example to demonstrate:
function argumentsTest (a,b) { alert(typeof arguments); } argumentsTest(1,2);
You can see that this is a pop-up in the browser window, and the argument type is object. The pop-up result is 4.
The following is the callee method, which returns the function object being executed.
function argumentsTest (a,b) { // alert(typeof arguments); alert(arguments.length); } argumentsTest(1,2);
function argumentsTest (a,b) { // alert(typeof arguments); // alert(arguments.length); alert(arguments[1]); } argumentsTest(1,2);