SOURCE

Array.prototype.flat = function(){
  return [].concat(this.map((item)=>{
     return Array.isArray(item)?item.flat():item
  }))
}
let arr = [1,2,3,[4,5,6]]
let a = arr.flat()
console.log(a)

console 命令行工具 X clear

                    
>
console