On Monday 24 April 2006 14:36, Todd Ross wrote:
> On 4/24/06, Martin Bialasinski <[EMAIL PROTECTED]> wrote:
> > On 4/24/06, Jeremy Kitchen <[EMAIL PROTECTED]> wrote:
> > > Is there no better way to merge one array into another than iterating
> > > over the array you wish to append with each() and push()ing the
> > > elements on to the other array?
> >
> > Anything wrong with the standard Javascript arr1.concat(arr2) ? :-)

aha!  just what I was looking for!

> Just to add to this ... it should be pointed out that this returns a
> new array (counter intuitive, if you ask me).
>
> arr1 = arr1.concat(arr2);
>
> If you need to append the contents of arr2 to arr1 without modifying
> your reference to arr1, then you need to loop through arr2 and push
> onto arr1.

fortunately, for my purposes concat will do fine :)

-Jeremy

-- 
Jeremy Kitchen ++ [EMAIL PROTECTED]

http://ipaction.org/ -- defend your rights to fair use

Attachment: pgpuX4KmZGUJg.pgp
Description: PGP signature

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to