Flattens a nested array into a single-dimensional array.
Flatten
const source = [1, [2, [3, [4, [5, 6]]]]] as const;const result = flatten(source);// result: [1, 2, 3, 4, 5, 6] Copy
const source = [1, [2, [3, [4, [5, 6]]]]] as const;const result = flatten(source);// result: [1, 2, 3, 4, 5, 6]
The type of the source array.
The array to flatten.
The flattened array.
Flattens a nested array into a single-dimensional array.
See
Flatten
Example