Using protoype.js I discovered a quick way to merge to arrays in javascript:
function array_merge(one, two) {
one.push(two);
return one.flatten();
}
This definitely beats the alternative of iterating through the second array by hand and adding it to the first. Any comments or suggestions are welcome.



You can do this even quicker!
one = one.concat(two);
Job done!
By Rumble on Aug 7, 2007
concat is KING
By Scott Meves on Jun 5, 2008