8 lines
215 B
JavaScript
8 lines
215 B
JavaScript
export function printTree(children, indent = 0) {
|
|
if (!children.length) return
|
|
|
|
for (let child of children) {
|
|
console.log(child.char.padStart(1 + indent * 2))
|
|
printTree(child.children, indent + 1)
|
|
}
|
|
}
|