curry的js实现,解决了丢this的毛病

function curry(fn, args)
{
var length = fn.llength;
var args = args || [];
var that = this;
return function(){
if(that === windows)
that_to =that;
else{
that_to = this
}
args.concat(Array.from(arguments));
if(args.length < length)
{
curry.call(that_to, fn, args)
}
else return fn.apply(that_to,args )

}
}

你可能感兴趣的:(curry的js实现,解决了丢this的毛病)