Calling a variadic function inside a variadic function in Javascript?

Every JavaScript function is really just another "object" (object in the JavaScript sense), and comes with an apply method (see Mozilla's documentation ). You can thus do something like this be = function(some, parameter, list) { ... } a = function(some, longer, parameter, list) { // ... Do some work... // Convert the arguments object into an array, throwing away the first element var args = Array.prototype.slice. Call(arguments, 1); // Call be with the remaining arguments and current "this" b.

Apply(this, args); }.

Every JavaScript function is really just another "object" (object in the JavaScript sense), and comes with an apply method (see Mozilla's documentation). You can thus do something like this.... be = function(some, parameter, list) { ... } a = function(some, longer, parameter, list) { // ... Do some work... // Convert the arguments object into an array, throwing away the first element var args = Array.prototype.slice. Call(arguments, 1); // Call be with the remaining arguments and current "this" b.

Apply(this, args); }.

Cool, I have just done a quick test and it works fine. Thanks for your help! – user433531 Jul 24 at 18:21.

1 Um, I think you should try this. The arguments object is not a real array and has no splice method. Does it work on your browser?

– Ray Toal Jul 24 at 18:10 You are absolutely correct! Edited, Thanks – Ivan Nikolchov Jul 24 at 18:15 You can't just call b(arguments). That will just pass an array in the first parameter.To pass an actual array of arguments, you have to use the apply method as in Adam Wright's answer.

– jfriend00 Jul 24 at 19:00.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions