Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Concat - Concatenate Arrays in JavaScript

Concate function is used to concatenate two or more arrays,
Syntax
Array1.concat(Array2,Array3,......ArrayN);

Example 1 : Join One Dimensional Arrays
var birds = ["Crow", "Eagle"];
var animals= ["Cat", "Lion", "Panda"];
var fruits= ["Mango"];
var misc = birds.concat(animals,fruits);

Example 2: Following Example Joins a two dimensional Array
function displayElements(theArray)
    {
      for(i=0; i<theArray.length; i++)
      {
        document.write(" - ",theArray[i][1]," ");
        document.write(theArray[i][0],"<br>");
      }
    }

    shelf1 = new Array(["A",10],["B",25]);
    document.write("Shelf 1 contains:<br>");
    displayElements(shelf1);
    
    shelf2 = new Array(["C",50],["D",3],["E",8]);
    document.write("Shelf 2 contains:<br>");
    displayElements(shelf2);
    
    inventory = shelf1.concat(shelf2);
    document.write("<br>The total inventory contains:<br>");
    displayElements(inventory);