MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See for all notifications.

Your Search Results



    Returns a new array comprised of this array joined with other array(s) and/or value(s).

    Method of Array instances
    Eklendiği Versiyon JavaScript 1.2
    ECMAScript Edition ECMAScript 3rd Edition

    Söz Dizimi

    array.concat(value1, value2, ..., valueN)


    Arrays and/or values to concatenate to the resulting array.


    concat creates a new array consisting of the elements in the this object on which it is called, followed in order by, for each argument, the elements of that argument (if the argument is an array) or the argument itself (if the argument is not an array).

    concat does not alter this or any of the arrays provided as arguments but instead returns a shallow 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. That is, if a referenced object is modified, the changes are visible to both the new and original arrays.
    • Strings and numbers (not String and Number objects): concat copies the values of strings and numbers into the new array.

    Any operation on the new array will have no effect on the original arrays, and vice versa.


    Example: Concatenating two arrays

    The following code concatenates two arrays:

    var alpha = ["a", "b", "c"];
    var numeric = [1, 2, 3];
    // creates array ["a", "b", "c", 1, 2, 3]; alpha and numeric are unchanged
    var alphaNumeric = alpha.concat(numeric);

    Example: Concatenating three arrays

    The following code concatenates three arrays:

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

    Example: Concatenating values to an array

    The following code concatenates three values to an array:

    var alpha = ['a', 'b', 'c'];
    // creates array ["a", "b", "c", 1, 2, 3], leaving alpha unchanged
    var alphaNumeric = alpha.concat(1, [2, 3]);

    See also

    Document Tags and Contributors

    Contributors to this page: ramesaliyev, teoli
    Last updated by: teoli,