[thelist] Javascript -- pass all parameters?

Matt Warden mwarden at gmail.com
Thu Oct 26 14:24:28 CDT 2006


On 10/26/06, Stephen Rider <evolt_org at striderweb.com> wrote:
> I'm pretty sure there is a way to do this, I just can't find the info --
>
> I have a Javascript function that receives a certain number of
> parameters (this tends to change from time to time).  Within this
> function I create a new function, and I want to be able to pass
> whatever parameters were handed to the master script into the
> subsidiary script.
>
> Thus:
>
> function hello($a, $b, [$c, $d... this changes]) {
>         blah;
>         blah;
>         x = new function( whatever parameters were passed to 'hello()' )
> { ...blah... };
> }
>
> Thanks for the assist!

There sure is. The apply function - one of the best features of modern
JavaScript:

http://www.webreference.com/js/column26/apply.html

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list