function findParents(treeData,id){ if(treeData.length==0) return for(let i=0;i<treeData.length;i++){ if(treeData[i].id == id){ return [] }else{ if(treeData[i].children){ let res = findParents(treeData[i].children,id) if(res !== undefined){ return res.concat(treeData[i].id)