Can the code for making new arrays in the computed of this vue be simplified?

computed: {

poolList () {
  const poolList = []
  this.bettingObjectList.forEach(bettingObject => {
    poolList.push(...bettingObject.poolList)
  })
  return poolList
},

}

think it"s tedious, can it be simplified

Aug.16,2021

of course it can be simplified. The logic is very simple. Extract the subarray and flatten it. Traditionally, you can write

like this.
computed: {
  poolList() {
    return [].concat(...this.bettingObjectList.map(({poolList}) => poolList));
  },
},

of course, you can also be more aggressive and directly use Array.prototype.flatMap ()

.
return this.bettingObjectList.flatMap(({poolList}) => poolList);
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-1e9c6dc-4661a.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-1e9c6dc-4661a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?