function User(){} function Admin(){} Admin.prototype=Object.create(User.prototype); let hd=new Admin(); console.log(hd instanceof Admin); console.log(hd instanceof User); //自定义写instanceof function checkPrototype(obj,constructor){ if(!obj.__proto__) return false; if(obj.__proto__==constructor.prototype) return true; return checkPrototype(obj.__proto__,constructor); } console.log(checkPrototype(hd,User));