es6 flat扁平化數組

var arr = [555,[888,[99]], , 999];數組 console.log(arr.flat(Infinity)) // [555, 888, 99, 999]it // console flat()默認只會拉平一層,flat(n)拉平n層,Infinity無限次co flat()會跳過空格,返回新數組不改變原數組
相關文章
相關標籤/搜索