array.flatten()

Flatten the Array elements.

Signature

flatten() => Array<T>

Description

The flatten() method flattens the Array elements, which returns a one-dimensional Array.

The source Array must be an Array of Arrays. If there are non-array elements in the Array, the function aborts the query.

Parameters

None

Return value

Type Description

Array

One-dimensional representation of the Array instance.

Examples

[[1, 2], [3, 4]].flatten()
[
  1,
  2,
  3,
  4
]

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!