Subj : Re: Using 'apply' to construct an object To : netscape.public.mozilla.jseng From : Peter Wilson Date : Tue Aug 30 2005 05:53 pm franck wrote: > Hello, > > When I need to call a function with a variable list of arguments, I use : > > var args = [ 111, 222, 333 ]; > myFunction.apply( this, args ); > > > Now I need to do the same thing with the constructor of an object, but I > am unable to find the right syntax. > Something like this : > > new myClass.apply( this, args ); // do not work ! > > > Thanks for any help. > > Franck. var newObj = new myClass(args) No this - because it's the constructor and is provided for you. Not method name because the class name is the constructor. Pete -- http://www.whitebeam.org ---- .