This method is like flatMap except that it recursively flattens the mapped results.
flatMap
The collection to iterate over.
Optional
The function invoked per iteration.
Returns the new flattened array.
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]
This method is like
flatMap
except that it recursively flattens the mapped results.