concat method

JsArray<E> concat(
  1. JsArray array1, [
  2. JsArray? array2,
  3. JsArray? array3
])

The concat method creates a new array. The array will first be populated by the elements in the object on which it is called. Then, for each argument, its value will be concatenated into the array — for normal objects or primitives, the argument itself will become an element of the final array; for arrays or array-like objects with the property Symbol.isConcatSpreadable set to a truthy value, each element of the argument will be independently added to the final array. The concat method does not recurse into nested array arguments.

The concat() method is a copying method. It does not alter this or any of the arrays provided as arguments but instead returns a shallow copy that contains the same elements as the ones from the original arrays.

The concat() method preserves empty slots if any of the source arrays is sparse.

The concat() method is generic. The this value is treated in the same way as the other arguments (except it will be converted to an object first), which means plain objects will be directly prepended to the resulting array, while array-like objects with truthy @@isConcatSpreadable will be spread into the resulting array.

Implementation

JsArray<E> concat(JsArray array1, [JsArray? array2, JsArray? array3]) =>
    jsu.callMethod(this, 'concat',
        [array1, if (array2 != null) array2, if (array3 != null) array3]);