Open s-jd opened 2 years ago
function myflatten(arr){ let res = [] let temp while(arr.length > 0){ temp = arr.shift() console.log("temp",temp); if(temp instanceof Array){ arr.unshift(...temp) } else{ res.push(temp) } } return res }