console.log(typeof String.prototype); // object
console.log(typeof Number.prototype); // object
console.log(typeof Object.prototype); // object
console.log(typeof Boolean.prototype); // object
console.log(typeof Function.prototype); // function
为什么typeof Function.prototype
返回“function”,而不是像其他原型(prototype)对象一样返回“object”?
谢谢!
最佳答案
这似乎是在 ECMAScript 5 中定义的:
15.3.4 Properties of the Function Prototype Object
The Function prototype object is itself a Function object (its
[[Class]]
is "Function") that, when invoked, accepts any arguments and returns undefined.
关于javascript - 在 JavaScript 中,为什么 typeof Function.prototype 是 "function",而不是像其他原型(prototype)对象那样 "object"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4859308/