set.aggregate()
Aggregate all the elements in the set.
Description
The aggregate()
method aggregates all array elements. There is no
ordering expectation.
The source set isn’t changed.
Return value
Type | Description |
---|---|
Aggregate of the iterable. If the iterable is empty, seed is returned. |
Examples
// `toSet()` converts an array to a set.
let set = [1, 2, 3, 4].toSet()
set.aggregate(0, (a, b) => a + b)
10
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!