The typeof operator returns the string "function" when used in a function, but the function is indeed a special type of JavaScript Object. Since functions are also objects, they should have attributes.
Attribute length
As we know, in the function body, The Length attribute of the arguments array specifies the number of arguments passed to the function. HoweverThe Length attribute of the function itself.It is a read-only feature,Returns the number of real parameters required by the function,That is, the number of parameters declared in the parameter list of the function. When calling a function, you can pass any number of real parameters to it. The function can obtain these parameters from the arguments array without considering the number of declared parameters. The Length attribute of the function object specifies the number of parameters declared by a function. Note: Unlike arguments. length, this Length attribute is valid both inside and outside the function body.
The following code defines a function named check ().Arguments. LengthAndArguments. callee. LengthTo determine whether the number of parameters passed to the function meets the requirements. Function check () is a detection function f (). The Code is as follows:
<HTML>