javascript - Function.prototype 是唯一没有原型(prototype)属性的函数吗?

标签 javascript

Function.prototype 是唯一没有 prototype 属性的函数吗?

为什么属性不存在,而不是具有值为 nullprototype 属性。

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/

相关文章:

javascript - 语法错误 : identifier starts immediately after numeric literal asp. 网络

javascript - 如何在滚动加载其他组件时 react js事件

Javascript - 调试 window.print()

javascript - 在 iframe 中访问 jqgrid

javascript - 关键字 "this"进入eventHandler函数,运行到类中

javascript - 原型(prototype)/脚本 : Selecting groups of paragraphs (<p>) by clicking on them

javascript - 如何使用普通 Javascript 在 div 中包含未知的 HTML?

javascript - 变量范围 - 本地和全局

javascript - jquery keyup 未触发

javascript - 如何使 Javascript Scroll 不那么跳动