Showing a tree of data

Start with one node:

var TREEdata={ children : [], label : "Vismay's Concept's" }

 

function TREEaddChildren(N){ for (var i=0; i < N; i++){ TREEdata.children[i] = { label : "Node " + i, children : []} } }

 

 

function TREErender(T){ var H = ''; H += "<div class='TREEnode'>" + T.label; for (var i=0; i < T.children.length; i++){ H+= TREErender(T.children[i]); } H += "</div>"; return H; }

We add a bit of styling:

We put a containing div around it.

We contain the tree with this:

 

 

 

 

 

 

Â