Javascript, how to deep flat
With the flat function that comes with ES6, we can do deep flatting on array
You can use Infinity to do this.
let arr = [1,2,[3,4,[5,6,[7,8],9]]];
arr.flat(Infinity);
Output;
[
1, 2, 3, 4, 5,
6, 7, 8, 9
]
With the flat function that comes with ES6, we can do deep flatting on array
You can use Infinity to do this.
let arr = [1,2,[3,4,[5,6,[7,8],9]]];
arr.flat(Infinity);
Output;
[
1, 2, 3, 4, 5,
6, 7, 8, 9
]