Array.flat

Array.flat

Array.flat

Function

Expand nested arrays depth-wise.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
depthIntNo1Expansion depth; negative numbers are treated as 0.

Return value

TypeDescription
ArrayReturns the new expanded array.

Example

Notes

  • The original array will not be modified.