How to use `flat()` and flatten an array with the depth of one?
const numbers = [1, 2, [3, 4], [5, 6]]
// returns [1, 2, 3, 4, 5, 6]
numbers.flat()
April 12th, 2020
flat()
can be used to flatten arrays with the depth of one (e.g. [1, [2, 3], 4]
). It returns a new array.