Function flatten

Returns a 'flattened' copy of array, un-nesting arrays one level

flatten([1, [2, 3], [[4]] ]);
// Yields: [ 1, 2, 3, [4]];
  • Parameters

    • array: any[] | readonly any[]

    Returns any[]