input function
number of arguments to apply
function context
function wrapper
function foo() {
var s;
var i;
s = 0;
for ( i = 0; i < arguments.length; i++ ) {
s += arguments[ i ];
}
return s;
}
var bar = naryFunction( foo, 2 );
var out = bar( 1, 2, 3, 4, 5, 6 );
// returns 3
Returns a function that applies a specified number of arguments to a provided function.
Notes
undefined
.