concat

Joins two arrays and returns a new array.

Applies to

Array

Syntax

concat(arrayName2)

Parameters

ArrayName2

Name of the array to concatenate to this array.

Description

concat does not alter the original arrays, but returns a one level deep copy that contains copies of the same elements combined from the original arrays. Elements of the original arrays are copied into the new array as follows:

Object references (and not the actual object) — concat copies object references into the new array. Both the original and new array refer to the same object. If a referenced object changes, the changes are visible to both the new and original arrays.

Strings and numbers (not String and Number objects) — concat copies strings and numbers into the new array. Changes to the string or number in one array do not affect the other arrays.

If a new element is added to either array, the other array is not affected.