html 模板
1
2
a
b
x
y
asd
js
let l = console.log let box = document.querySelector('.box') let toArray = Array.from; scan(box) function scan(box) { let arr = toArray(box.children) for (let ele of arr) { if (ele.children.length) { scan(ele) }else{ l( ele) } } }