65
rated 0 times
[
71]
[
6]
/ answers: 1 / hits: 33348
/ 12 Years ago, wed, november 28, 2012, 12:00:00
Let's take a look at this code:
var mainFunction = function() {
altFunction.apply(null, arguments);
}
The arguments that are passed to mainFunction
are dynamic -- they can be 4 or 10, doesn't matter. However, I have to pass them through to altFunction
AND I have to add an EXTRA argument to the argument list.
I have tried this:
var mainFunction = function() {
var mainArguments = arguments;
mainArguments[mainArguments.length] = 'extra data'; // not +1 since length returns "human" count.
altFunction.apply(null, mainArguments);
}
But that does not seem to work. How can I do this?
More From » javascript