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.

Concatenate two Arrays.

Signature

concat(other: Array<B>) => Array<A | B>

Description

Creates an Array by copying the calling array to a new Array and appending another Array.

The calling Array and the other Array aren’t changed.

Parameters

Parameter Type Required Description

other

Array<Generic>

Yes

Array to append to the calling Array.

Return value

Type Description

Array<Generic>

Array composed of the concatenated Arrays.

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!