function _flatten(arr){ const result = []; arr.forEach(item=>{ if(Array.isArray(item)){ result.push(..._flatten(item)); }else{ result.push(item); } }); return result; }