本文介绍了instanceof和constructor属性之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

b的实例是否等于 a.constructor === b

如果没有,请告诉我这些之间的区别。

Is a instanceof b exact equals to a.constructor === b?
if not, please tell me the difference between these.

推荐答案

否。

instanceof 还检查继承的构造函数。

instanceof also checks for "inherited" constructors.

有关详细信息,请参阅规范。 (和)

For more information, see the spec. (here and here)

这篇关于instanceof和constructor属性之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 14:30