Array.flat_map

Array.flat_map

Array.flat_map

Function

First map and then expand the mapping result by depth 1.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
callbackFnNoEmptyThe callback signature is fn(value, index, current).

Return value

TypeDescription
ArrayReturns the new array after mapping and expansion.

Example

Notes

  • Expand only one level of array.