Sunday, January 18, 2009

Joining Two Arrays in javascript

The Array object’s concat() method allows us to concatenate arrays. We can add two or more
arrays using this method, each new array starting where the previous one ends. Here we’re
joining three arrays: arrayOne, arrayTwo, and arrayThree:


The new array, joinedArray, has 12 items. The items in this array are the same as they were
in each of the previous arrays; they’ve simply been concatenated together. The original arrays
remain untouched.



Thanks
Amita Vashisht

No comments:

Post a Comment