Constructs a new array from an array plus appended elements.
Parameters |
Description |
object |
The value of a new element. A parameter can
be an array. There can be any number of parameters. |
Return value |
Description |
Object[] |
The new array. The new array contains the elements
of the base array followed by the values of the parameters. |
Usage
This method does not modify the base
array.
Examples
This computed label constructs a new
array by concatenating two arrays and a string.
var a = new Array("one", "two", "three");
var b = new Array("four", "five");
var abc = a.concat(b, "six");
var display = "";
for(var i=0; i<abc.length; i++) {
display = display + abc[i] + ", ";
}
display = display.left(display.length - 2);
display // one, two, three, four, five, six