How to extract a certain health value from multi-layer nesting?

[{
          id: 1,
          label: " 1",
          children: [{
            id: 4,
            label: " 1-1",
            children: [{
              id: 9,
              label: " 1-1-1"
            }, {
              id: 10,
              label: " 1-1-2"
            }]
          }]
        }, {
          id: 2,
          label: " 2",
          children: [{
            id: 5,
            label: " 2-1"
          }, {
            id: 6,
            label: " 2-2"
          }]
        }]

how do three-level menu data nesting fetch all id push into an array

Aug.16,2021

const ids = arr.reduce((total, cur) => {
  total.push(cur.id)
  if (cur.hasOwnProperty("children")) {
    total.push(...cur.children.reduce((a, b) => {
      a.push(b.id)
      if (b.hasOwnProperty("children")) {
        a.push(...b.children.reduce((x, y) => {
          x.push(y.id)
          return x
        }, []))
      }
      return a
    }, []))
  }
  return total;
}, [])
console.log(ids)
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-1b3c783-2c322.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-1b3c783-2c322.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?