2017-10-09 62 views

回答

0

你可以試試這個模式:

var leafNodes = []; 

tree.visit(function(node){ 
    if (!node.hasChildren()) { 
     leafNodes.push(node); 
    } 
});