0

代码:

var test = {
    con: true
};

var conrun= function(){
    return this.con;
};

Function.prototype.curry = function(scope){
    var fn = this;
    var scope = scope||window;
    return function(){
        fn.apply(scope,arguments);
    }
}

conrun = conrun.curry(test);
alert(conrun());
//result:undefined

"curry" 方法,函数将返回,"conrun" fonkiyonuna "test" 添加到...的范围

我该怎么办 ?

4

1 回答 1

1

curry失去了返回值。将该行更改为:

return fn.apply(scope, arguments);
于 2013-04-06T22:46:18.370 回答