个人练习,代码如下:
function myInstanceOf(o,type){
if(typeof o !== 'object' || o === null){
return false
}
if(Object.getPrototypeOf(o) === type.prototype){
return true
}else{
return myInstanceOf(Object.getPrototypeOf(o),type)
}
}
标签:instanceOf,return,Object,getPrototypeOf,myInstanceOf,手写,type
From: https://www.cnblogs.com/justin999/p/17452697.html