The collection to iterate over.
Optional
iteratee: ArrayIteratee<T, T[]>The function invoked per iteration.
Optional
Returns the new flattened array.
5.4.0
[[flatMapDeep]],[[flatMapDepth]],[[flatten]],[[flattenDeep]],[[flattenDepth]],[[map]],[[mapKeys]],[[mapValues]]
function duplicate(n) {
return [n, n]
}
flatMap([1, 2], duplicate)
// => [1, 1, 2, 2]
Optional
iteratee: RecordIteratee<T, Record<string, T>>Optional
Creates a flattened array of values by running each element in
collection
thruiteratee
and flattening the mapped results. The iteratee is invoked with three arguments: (value, index|key, collection).