Is there a simple way to passing all arguments from one function to another and sending this
also.
I have tried this: http://jsfiddle.net/v92Xr/
var f1 = function() {
f2.call(this, arguments);
};
var f2 = function() {
console.log(arguments);
};
f1("abc", "def", "hij");
but it leaves me all the arguments from f1 is stacked in f2 arguments 0:
f2->arguments[0] == f1->arguments
Ok and when i run the apply
method instead it works: http://jsfiddle.net/v92Xr/1/
var f1 = function() {
f2.apply(this, arguments);
};
var f2 = function() {
console.log(arguments);
};
f1("abc", "def", "hij");
So can anyone please tell me what's the difference between call
and apply
is?