next up previous contents
Next: join Up: Methods Previous: Methods   Contents


concat

Description

concatenates the elements specified in the parameters, if any, with the elements in array1, and creates a new array. If the value parameters specify an array, the elements of that array are concatenated, rather than the array itself. The array array1 is left unchanged


Syntax

array1.concat(value_0, value_1, ..., value_N)


Parameters

value_0, value_1, ..., value_N
Numbers, elements, or strings to be concatenated in a new array.


Returns

An new Array object containing the concatenation of array1 and value_0, value_1, ..., value_N. For example:

a = new Array();
b = new Array("e", "f", "g", "h");
a[0] = "a";
a[1] = "b";
r = a.concat("c", "d", b);
trace(r);
//output: a, b, c, d, e, f, g, h
If a value smaller than its previous value is assigned to the length property, the array is truncated, and any elements with array indexes equal to or greater than the new value of the length property are lost. If a value larger than its previous value is assigned to the length property, the array is expanded, and any new elements created have the value undefined.




Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.