Something that people may not see immediately is that flatMap is more general than map <i>and</i> filter. Say, for a contrived example, that you'd like to filter out the even numbers in an array, and then double the odd numbers that remain. Instead of:<p><pre><code> [1, 2, 3, 4, 5].filter(n => n % 2 === 1).map(n => n * 2)
</code></pre>
You can do:<p><pre><code> [1, 2, 3, 4, 5].flatMap(n => n % 2 === 1 ? [n * 2] : [])
</code></pre>
Again, this is a contrived example, but I think it's interesting since the generality is not obvious (to me)