从new关键字创建的对象在JavaScript中没有原型?

时间:2017-07-17 08:22:30

标签: javascript prototype

根据w3school Every JavaScript object has a prototype. The prototype is also an object.

但是让我们来研究一下:

var SomeObject = { name: "foo" }
SomeObject.prototype // Undefined although its an object

我知道__proto__它有

function SomeFunction () {

}
SomeFunction.prototype // object

但是

var SomeOtherObject = new SomeFunction()
SomOtherObject.prototype // undefined but its is an object 

这与w3school声明Every JavaScript object has a prototype. The prototype is also an object

相矛盾

知道为什么吗?

0 个答案:

没有答案