为什么Object.prototype instanceof Object为false? [英] Why is Object.prototype instanceof Object false?
本文介绍了为什么Object.prototype instanceof Object为false?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么以下返回false?
Why does the following return false?
Object.prototype instanceof Object
推荐答案
因为它基本上询问 Object.prototype
是否支持继承自对象
的 .prototype
对象:它没有。
Because it basically asks whether Object.prototype
does inherit from Object
's .prototype
object: It does not.
b的实例
相当于 b.prototype.isPrototypeOf(a)
- 它测试是否 b.prototype
位于 a
的原型链中。在你的情况下,它不是 in 链,因为它是链本身的起点。 isPrototypeOf
不反身。
a instanceof b
is equivalent to b.prototype.isPrototypeOf(a)
- it tests whether b.prototype
is in the prototype chain of a
. In your case, it is not in the chain, because it is the start of the chain itself. isPrototypeOf
is not reflexive.
这篇关于为什么Object.prototype instanceof Object为false?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文