I have tree of objects:
let tree = {id: 1, children: [{id: 2, children: [{id: 3}]}]}
I want to store all id
in this tree in file with tab for elements that have children:
1
2
3
I use this function to show elements of tree:
show(tag: XMLtag) {
console.log(tag.show());
if (tag.getChildren().length == 0) {
return;
}
tag.getChildren().forEach((c) => {
this.show(c);
});
}
This function gives me:
1
2
3
Is it possible to write result to text file or display on the browser page with formatting?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…