【发布时间】:2016-02-29 20:35:16
【问题描述】:
当像这样从窗口对象创建以下函数时,
function userInfo() {};
为什么 userInfo.constructor 显示 Function 而不是 Object,因为函数是对象?
在使用以下内容时,它甚至显示 Function 而不是 Object,
Function.constructor
【问题讨论】:
-
数组是具有 Array 构造函数的对象。 Date 实例是具有 Date 构造函数的对象。某些东西可以是一个对象,而不是由 Object 构造函数构造。
-
Functions 是对象,而不是Objects。 -
为什么
new userInfo.prototype.constructor()创建对象而new userInfo.constructor()没有?
标签: javascript