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.

set.last()

Get the last element of a Set.

Signature

last() => A | Null

Description

Returns the last element of the Set. The method reverses the Set and gets the first item.

Parameters

None

Return value

One of:

Type Description

Generic

Last element of the Set.

Null

Returned if the Set is empty.

Examples

// `toSet()` converts an Array to a Set.
let set = [1, 2].toSet()
set.last()
2

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!