A-C > Array.concat

Array.concat

Syntax

myArray.concat(value0,value1,...valueN);

Arguments

value0,...valueN Numbers, elements, or strings to be concatenated in a new array.

Description

Method; concatenates the elements specified in the arguments, if any, and creates and returns a new array. If the arguments specify an array, the elements of that array are concatenated, rather than the array itself.

Player

Flash 5 or later.

Example

The following code concatenates two arrays:

alpha = new Array("a","b","c");
numeric = new Array(1,2,3);
alphaNumeric=alpha.concat(numeric); 
// creates array ["a","b","c",1,2,3]

The following code concatenates three arrays:

num1=[1,3,5];
num2=[2,4,6];
num3=[7,8,9];
nums=num1.concat(num2,num3) // creates array [1,3,5,2,4,6,7,8,9]