cuốn sách gpt4 ai đã làm

javascript - 'Function' 上的 MDN 描述感到困惑,Function.length 是 Function 或 Function.prototype 的属性

In lại Tác giả: Walker 123 更新时间:2023-11-28 05:33:36 hai mươi bốn 4
mua khóa gpt4 Nike

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function

据说

Properties and Methods of Function 

The global Function object has no methods or properties of its own, however, since it is a function itself it does inherit some methods and properties through the prototype chain from Function.prototype.

然后它继续说

Function prototype object 
Properties

Function.arguments
An array corresponding to the arguments passed to a function. This is deprecated as property of Function, use the arguments object available within the function instead.
Function.arity
Used to specifiy the number of arguments expected by the function, but has been removed. Use the length property instead.
Function.caller
Specifies the function that invoked the currently executing function.

Function.length (!!!here is what I confused, why it does not display Function.prototype.length)

Specifies the number of arguments expected by the function.
Function.name
The name of the function.
Function.displayName
The display name of the function.

Function.prototype.constructor

Specifies the function that creates an object's prototype. See Object.prototype.constructor for more details.
Methods

只是想知道 Function.length 是否是 Function.prototype 的属性?

欢迎您发表评论

câu trả lời hay nhất

từMDN docs on Function.length :

The Function constructor is itself a Function object. Its chiều dài data property has a value of 1.

Function.length 等于 1,bởi vì Function 构造函数采用一个形式参数 - 函数体。

The chiều dài property of the Function prototype object has a value of 0.

Function.prototype.length 等于 0,bởi vì Function.prototype 不接受任何参数。

关于javascript - 'Function' 上的 MDN 描述感到困惑,Function.length 是 Function 或 Function.prototype 的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39524513/

hai mươi bốn 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress