This method is like flatMap except that it recursively flattens the mapped results.
flatMap
5.4.0
[[flatMap]],[[flatMapDepth]],[[flatten]],[[flattenDeep]],[[flattenDepth]],[[map]],[[mapKeys]],[[mapValues]]
function duplicate(n) { return [[[n, n]]]}flatMapDeep([1, 2], duplicate)// => [1, 1, 2, 2] Copy
function duplicate(n) { return [[[n, n]]]}flatMapDeep([1, 2], duplicate)// => [1, 1, 2, 2]
The collection to iterate over.
Optional
The function invoked per iteration.
Returns the new flattened array.
This method is like
flatMap
except that it recursively flattens the mapped results.Since
5.4.0
See
[[flatMap]],[[flatMapDepth]],[[flatten]],[[flattenDeep]],[[flattenDepth]],[[map]],[[mapKeys]],[[mapValues]]
Example