arr =[1,2,3,[7,9],[8,9,[10,1]]]
arr.flat(Infinity)
arr.join().split(',').map(Number)
const flatten=arr=>{const result=[]while(arr.some(item=>Array.isArray(item))){result.concat(...arr)}return result}
const flatten=arr=>arr.reduce((acc,cur)=>(Array.isArray(cur)?[...acc,...flatten(cur)]:[...acc,cur]),[])