In Javascript how can I get the full ancestral hierarchy in a string given just a single object? Right now I can't even think about how to ask the question... so I can't even google it. Here's an example:
var lvl1 = { one: "one", two: "two" };
lvl1.lvl2 = {flip:"flip", flam:"flam"};
lvl1.lvl2.lvl3 = {who:"who", what:"what"};
test(o) {
alert( hierarchyToString(o) );
}
var tmp = lvl1.lvl2.lvl3;
test(tmp);
I want to see:
"lvl1.lvl2.lvl3"
possible? what if I passed in the final leaf string:
test(lvl1.lvl2.lvl3.what);
possible? hopefully that code makes sense... just off top of my head...
Thank you!