contents   index   previous   next

Array concat()


array.concat([element1, ...])


elementN - list of elements to be concatenated to this Array object.



object - a new array consisting of the elements of the current object, with any additional arguments appended.



The return array is first constructed to consist of the elements of the current object. If the current object is not an Array object, then the object is converted to a string and inserted as the first element of the newly created array. This method then cycles through all of the arguments, and if they are arrays then the elements of the array are appended to the end of the return array, including empty elements. If an argument is not an array, then it is first converted to a string and appended as the last element of the array. The length of the newly created array is adjusted to reflect the new length. Note that the original object remains unaltered.



String concat()



var a = new Array(1,2);

var b = a.concat(3);


Array join()