想不通为什么深搜有问题,求某佬指点一下...function findNode(tree, target) { if (tree.name === target) { return tree.val; } if (tree.children) { for (const child of tree.children) { const result = findNode(child, target); if (result) { return result; } } } return null;}// 输入的树结构const tree = { val: 'rootVal', name: 'rootName', children: [ { val: 'childVal', name: 'childName', children: [ { val: 'child1-1Val', name: 'child1-1Name' } ] }, { val: 'child2Val', name: 'child2Name' } ]};// 输入的目标节点名称const target = 'rootName';const result = findNode(tree, target);console.log(result);