← TechnologyThe essentials of

flatMap(): from one record to zero or several

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 12:40. This is not editorial approval.

In a few sentences

In brief

The transformation and removal of one nested level occur together.

Useful to know

flatMap() performs a function for each element and flattens the resulting result by one level. For example, [1, 2].flatMap(x => [x, x * 10]) gives [1, 10, 2, 20]. [1]

The feature can return an empty record array that needs to be dropped, or several expansion items. This is convenient when converting rows to individual positions. Do not expect recursive removal of any nesting: an additional array inside the returned list remains on the next level.

Sources

For further detail and to check the information:

  1. [1] MDN — Array.flatMap ↗