Function.prototype
是唯一没有 prototype
属性的函数吗?
为什么属性不存在,而不是具有值为 null
的 prototype
属性。
document.write(Object.getOwnPropertyNames(Function.prototype));
编辑:大概是 prototype
属性被省略了,因为它没有 [[Construct]]
内部方法(它不是构造函数)。
最佳答案
啊,刚刚发现 section 9.3第 6 段说:
Built-in functions that are not constructors do not have a prototype property unless otherwise specified in the description of a particular function.
所有“普通”函数都有[[Construct]]
内部方法(section 9.2.3):
If functionKind is "normal", let needsConstruct be true.
奇异的内置函数可能有也可能没有 [[Construct]]
内部方法,如果没有,那么它们就没有 prototype
属性, “除非另有规定”。
关于javascript - Function.prototype 是唯一没有原型(prototype)属性的函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38411387/