[thelist] Javascript -- pass all parameters?

Ben Glassman bglassman at gmail.com
Thu Oct 26 14:24:31 CDT 2006


Stephen,

You can access all of the arguments passed to a function using the
.arguments property of that function.

function hello('blah','blah2','blah3') {
     var args = hello.arguments;
          x = new function(args);
}

Each argument can be accessed like an array (args[0] would be 'blah',
args[1] would be 'blah2').

Hope thats helpful

Ben

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!
>
> Stephen
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list