Js multi-layer nested array to extract the data from the last layer?

you need to get a collection of all the id of isCheck = true

list: [{
  id: "1",
  isCheck: false,
  children: [{
    id: "1-1",
    isCheck: false,
    children: null
  }, {
    id: "1-2",
    isCheck: true,
    children: null
  }]
}, {
  id: "2",
  isCheck: false,
  children: [{
    id: "2-1",
    isCheck: true,
    children: null
  }]
}, {
  id: "3",
  isCheck: true,
  children: null
}]

think of using recursive algorithm to flatten and degrade the array, but the data obtained is not right. I hope to get the data

.
["1-2", "2-1", "3"]
  steamroller: function (arr) {
    let newArr = []
    let flat = function (item) {
      for (var i = 0; i < item.length; iPP) {
        if (Array.isArray(item[i].children)) {
          flat(item[i])
        } else {
          newArr.push(item[i])
        }
      }
    }
    flat(arr)
    return newArr
  }

ask for help!



children id

function funEach(data){
    var arr = new Array();                //    
    /*     */
    for(var i = 0;i < data.length;iPP){
        /*        */
       if(data[i]['children'][0] != undefined){
           var l = data[i]['children'][0];            //    
           for(var iOne = 0;iOne < l.length;iPP){
               arr[] = l['id'];
           }
       }
    }
    return arr;
}

well, according to my logic, it should be no problem.

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-1b30a7c-e27f.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-1b30a7c-e27f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?