set.lastWhere()
Get the last element that matches the given predicate.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
Yes |
Boolean function that tests every element and returns elements that match the predicate. |
Examples
// `toSet()` converts an array to a set.
let set = [1, 2, 3, 4].toSet()
set.lastWhere(v => v > 2)
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!