flatten

function flatten<T>(arr: T[][]): T[]

Flattens a nested array by one level.

const arr = [[1, 2], [3, 4], [5]];
const flattened = Utils.flatten(arr);
console.log(flattened); // [1, 2, 3, 4, 5]
Parameter
Type
Optional
Description

arr

T[]

The array to flatten

Last updated