You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function myFlat(arr) {
let result = [];
for(let i = 0; i < arr.length; i++) {
if (Array.isArray(arr[i])) result = result.concat(myFlat(arr[i]))
else result = result.concat(arr[i])
}
return result;
}
利用concat入参是数组时,相当于自动铺平一层
方法一:
方法二:
The text was updated successfully, but these errors were encountered: