Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

array.at()

Get the Array element at a provided index.

Signature

at(index: Number) => A

Description

Gets the Array element located at a provided index. The method is equivalent to using [] indexing, such that array.at(0) returns the same element as array[0].

Parameters

Parameter Type Required Description

index

Number

Yes

Location of the Array element to return. Must be an Int.

Arrays have zero-based indexes. Valid index values are zero to one less than the Array length. Invalid index values result in an error.

Return value

Type Description

Generic

Array element located at the provided index.

Examples

Get the element at index location four:

[1, 2, 3, 4, 5].at(4)
5

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!