Array.map

Array.map

Array.map

Function

Iterate through the array and combine the callback return values into a new array.

Syntax

Parameters

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

Return value

TypeDescription
ArrayReturns the new array after mapping.

Example

Notes

  • The original array will not be modified.