一、将arguments对象绑定到slice方法上
二、 例子:
//闭包 二次封装函数 求和
function partialUsingArguments(fn) {
var args = Array.prototype.slice.call(arguments, 1);
var result = function () {
var args2 = Array.prototype.slice.call(arguments);
args = args.concat(args2);
return fn.apply(this, args); }
return result;
} var a = 1; var b = 2; var c = 3; var d = 4;
var test = function (first, second, third, forth) {
return first + second + third + forth;
};
console.log("1+2+3+4="+ partialUsingArguments(test, a, b)(c, d) );