last()

Get the last element in an array.

Signature

last(): Any | Null

Description

The last() method returns the last element of the array.

Parameters

None

Return value

Type Description

Any

Last element of the array or null if the array is empty.

Examples

let iter = [1]
iter.last()
1

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!