concat()

Create an Array by concatenating two Arrays.

Signature

concat(otherArray: Array<T>): Array<T>

Description

The concat() method creates an Array by copying the calling array to a new array and appending otherArray.

the calling array and otherArray aren’t changed.

Parameters

Parameter Type Required Description

otherArray

Array

Yes

Array to append to the calling array.

Return value

Type Description

Array

Array composed of otherArray appended to the calling array.

Examples

This example concatenates the second Array to the first:

[0, 1, 2, 3, 4].concat([3, 2, 1, 0])
[
  0,
  1,
  2,
  3,
  4,
  3,
  2,
  1,
  0
]

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!