array.concat()

This method operates on an array. You typically fetch documents from a collection as a set, not an Array. For the equivalent Set method, see set instance methods.

For differences between Sets and Arrays, see Sets vs. Arrays.

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!