let arr = [1,2,3,[4],5,6,[7]] let asn =arr.flat() let aa = arr.reduce((t,c,i,a)=>{ return t.concat(c) },[]) console.log(aa)