例如:

1
2
3
4
var arr = [1,[3,4],[5,6,7]]

1. arr.flat() // [1,3,4,5,6,7]
2. arr = [].concat(...arr);