Maps each element to an Iterable and flattens the result.
Type of items in the source.
Type of items in the resulting Iterable.
Mapping function.
Operation that maps each element to an Iterable and flattens the result.
const result = flatMap<number, number>((value) => [value, value + 1])([1, 2, 3]);console.log([...result]); // [1, 2, 2, 3, 3, 4] Copy
const result = flatMap<number, number>((value) => [value, value + 1])([1, 2, 3]);console.log([...result]); // [1, 2, 2, 3, 3, 4]
Maps each element to an Iterable and flattens the result.