js 按尝试深度优先,获取所有子级?-灵析社区

MaxClick

js 按尝试深度优先,获取所有子级? ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241009/278bf56c8ec8fcbc658ebad2be03c167.png)

阅读量:144

点赞量:0

问AI
二叉树? var dfs = node => node ? [...dfs(node.left), ...dfs(node.right), node] : []