Arguments in Js

Before understanding this object, let's first understand some functions of javascript:

In fact, Javascript does not have the function of overloading functions, but the Arguments object can simulate overloading. Each function in Javascript will have an instance of the Arguments object, arguments, which refer to the actual parameters of the function. You can use the array subscript "[]" to refer to the elements of arguments. arguments.length is the number of function arguments, and arguments.callee refers to the function itself.

 

argumentsHis features and usage

characteristic:

The arguments object and Function are inseparable. Because the arguments object cannot be created explicitly, the arguments object is only available at the beginning of the function.

Instructions:

Although the arguments object is not an array, accessing a single argument is done in the same way as an array element

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325073037&siteId=291194637
Recommended