首页 > javascript函数化模式模拟处理父类方法

javascript函数化模式模拟处理父类方法

关键代码如下:

Function.prototype.method = function (name,func){
    if(!this.prototype[name]){
        this.prototype[name]=func;
    }
    return this;
}
Object.method('superior',function(name){
    var that=this,method=that[name];
    return function(){
        return method.apply(that,arguments);
    }; 
});

问题:求解释Object.method函数里面this、arguments分别指的什么?


This 是执行该函数的对象,arguments 是函数执行时的参数数组

【热门文章】
【热门文章】