Forum Discussion
Anton_A
14 years agoOccasional Contributor
Regarding previous posts, the error was fired because the recursion was placed outside of loop.
Below is another version of this function, but it doesn't work as well. It call return twice. You can see sequential debug steps in the attached screenshots. Thanks, Anton.
function FindNode(treeObj, soughtNode) {
for (var i = 0; i < treeObj.Nodes.Count; i++) {
var node = treeObj.Nodes.Item(i);
if(SameText(soughtNode, node.Text.OleValue)) {
return node;
}
FindNode(node, soughtNode);
} return Utils.CreateStubObject();
}
Below is another version of this function, but it doesn't work as well. It call return twice. You can see sequential debug steps in the attached screenshots. Thanks, Anton.
function FindNode(treeObj, soughtNode) {
for (var i = 0; i < treeObj.Nodes.Count; i++) {
var node = treeObj.Nodes.Item(i);
if(SameText(soughtNode, node.Text.OleValue)) {
return node;
}
FindNode(node, soughtNode);
} return Utils.CreateStubObject();
}
Related Content
- 5 years ago
Recent Discussions
- 2 days ago