Variable-Length Argument Lists: The Arguments Obje

The Arguments object has one very unusual feature. When a function has named arguments, the array
elements of the Arguments object are synonyms for the local variables that hold the function arguments.
The arguments[] array and the named arguments are two different ways of referring to the same variable.
Changing the value of an argument with an argument name changes the value that is retrieved through
the arguments[] array. Conversely, changing the value of an argument through the arguments[] array
changes the value that is retrieved by the argument name.


Finally, bear in mind that arguments is just an ordinary JavaScript identifier, not a reserved word. If a
function has an argument or local variable with that name, it hides the reference to the Arguments object.


For this reason, it is a good idea to treat arguments as a reserved word and avoid using it as a variable
name.

你可能感兴趣的:(JavaScript,idea)