array.forEach()
This method operates on an array. You typically fetch documents from a collection as a set, not an array. For the equivalent set method, see set instance methods. For differences between sets and arrays, see Sets vs. arrays. |
Description
The forEach()
method sequentially calls function for each
Array element, passing the element value as an argument to
function.
The calling array isn’t changed.
Array iteration methods
FQL provides several methods for iterating over an array.
array.forEach()
and
array.map()
are similar but used
for different purposes:
Method | Primary use | Notes |
---|---|---|
Perform in-place writes on array elements. |
Doesn’t return a value. |
|
Return a new array with projected or transformed elements. |
Can’t perform writes. |
|
Similar to |
Can’t perform writes. |
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!