写了一个模拟instanceof的函数
function instanof(obj,func){
if(func.prototype==undefined){
throw new Error("这个func是什么鬼@_@");
}
if(typeof obj != 'object'){
throw new Error("这个obj是什么鬼@_@");
}
var a=obj.__proto__;
while(a!=undefined){
if(a===func.prototype){
return true;
}
a=a.__proto__;
}
return false;
}老师你看看写的没错吧~嘛?