With Tree-and-Node objects, in this case PrimeNg Tree objects (Angular 8) is there a better (more succinct, efficient) way of handling recursive child nodes than this:
for (let treeNode of treeNodes) {
if (treeNode.children != null) {
for (let child1 of treeNode.children) {
// do stuff on children level 1
if (child1.children != null) {
for (let child2 of child1.children) {
// do stuff on children level 2
if (child2.children != null) {
// etc
ie Is there a way I can avoid a Russian-doll type situation, particularly if I don't know how far deep it goes?