Mapping works a bit like a combination of
forEach(). It returns all matched elements, after
they have been iterated (and potentially altered) using
map() callback (which accepts
Map matched occurrences
So instead of returning all elements:
...you can map them - to any other value, by callback:
Arbitrary return types
Again, just like
first(), this method can return values of any type, including: objects, arrays,
You can just as easily create a flattened map.
Read more about
flatMap() on the next page.