I have a tree object structured like this
function Node(){
this.Info = "";
this.Children = []; //Array of nodes
}
I have to validate the children under the parent. How do I do that using reflection? This is what I have so far.
function validChildren(node){
if(!node.Children || node.Children.length == 0) return true;
for(var child in node.Children){
if(child.Children && child.Children.length > 0){
if(!validChildren(child)) return false;
}
if(!validateChild(someParentObject, child.Info)) return false;
}
return true;
}
function validateChild(parent, info){
//Assume this is implemented
}