You want Function#apply.

see 
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Function:apply

Best,
Thomas

Am 29.11.2007 um 07:39 schrieb Gareth Evans:

> Hey Guys
>
> Does anyone know if I have an array if I can pass that array to a  
> function, *as* the parameters.. not pass it as a parameter, but  
> effectively have my scoped array become function.arguments.
> I have a regular expression that splits an ISO date string that's  
> given me a match array, which I then split to drop the first match  
> (the whole string) leaving me with year,month,day,hour,min,sec and I  
> want to pass that to new Date()
> I could go var d = new Date(ma[0],ma[1],ma[2]... but I figure if I  
> can do the arguments thing then its a technique i could adopt  
> elsewhere.
> I control both sides of the interface, the source as well as the  
> processing so I know the format will always be the same.
> (incidentally, the date comes from a .net date originally, and I use  
> a .tostring("s") to get the iso format, which is passed to json as a  
> string - there may be a better way for that)
>
> Hope this makes sense,
>
> Gareth
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to