js instanceof

a instanceof b:
1,首先a不是对象,返回false,b的原型不是对象抛出TypeError
2,取得b的prototype标记为bp,对a的原型链做循环,令ap为当前原型,如果ap与bp指向同一个对象,则返回ture
c=[]
c instanceof Array
true
c instanceof Object
true

均返回true
var f=function(){}
var ff=new f()
ff instanceof f
true
原文地址:https://www.cnblogs.com/mufc-go/p/3765778.html