instanceof的原理跟链表有关
const instanceofs = (target,obj)=>{
let p = target;
while ( p ){
if( p == obj.prototype){
return true
}
p = p._proto
}
return false;
}
conso.log(instanceofs([1,2,3],Object))
instanceof的原理跟链表有关
const instanceofs = (target,obj)=>{
let p = target;
while ( p ){
if( p == obj.prototype){
return true
}
p = p._proto
}
return false;
}
conso.log(instanceofs([1,2,3],Object))