How does js convert a two-dimensional array nested two-dimensional array into an one-dimensional array?

two-dimensional array nested two-dimensional array into one-dimensional array?

list(newV) {
  this.newList = newV;
  this.OrderItems = this.newList.map(item => item.OrderItems);
  console.log("OrderItems", this.newList);
}

data processing returned
clipboard.png

map, ,

clipboard.png

Apr.01,2022

function flatten(arr) {
    var res = [];
    arr.map(item => {
        if(Array.isArray(item)) {
            res = res.concat(flatten(item));
        } else {
            res.push(item);
        }
    });
    return res;
}

this.OrderItems = [].concat(...this.newList.map(item => item.OrderItems));

encapsulates a function, which can be called directly

function steamroller(arr) {
  const newArr = [];
  for (let i = 0; i < arr.length; iPP) {
    if (Array.isArray(arr[i])) {
      newArr.push(...steamroller(arr[i]));
    } else {
      newArr.push(arr[i]);
    }
  }
  return newArr;
}

try console.log ([... this.newList,... this.OrderItems])

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea553e-47b0f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea553e-47b0f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?