如果我遗漏了一些明显的东西,我不会这样做,但是当我执行以下操作时:-
Object.prototype.inherit = function(fromClass) {
fromClass.apply(this, Array.prototype.slice.call(arguments, 1));
for(var key in fromClass.prototype){
if(typeof fromClass.prototype[key] == 'function')
this.prototype[key] = fromClass.prototype[key];
}
};
然后我就不能再处理任何对象了。我总是不确定。同样,当我尝试将某些方法“注入”到Array.prototype
然后数组停止工作时!我正在使用 Firefox 4.0.1。
我错过了什么吗?