只要将以下代码添加到我的 html 页面,我就会得到:
Uncaught TypeError: Object function (constrname) {
if(this.constructor.name===constrname){
return true;
}
return false;
} has no method 'exec'
这是导致错误的原型:
Object.prototype.isInstanceOf=function(constrname) {
if(this.constructor.name===constrname){
return true;
}
return false;
};
添加原型似乎打破了 jQuery 。
在为 Object 类型定义新原型时,我可以排除某些类型吗?例如,排除:jQuery 类型,...
我尝试了以下代码,但它是徒劳的:
Object.prototype.isInstanceOf=function(constrname) {
if(!(this instanceof jQuery)){
//write here code
}
}