JavaScript 本身是不支持这种查找的, 因为"子对象"只是父对象中的一个引用, 它也可以被其它对象引用, 这样一个"子对象"就可能有多个"父对象". 能实现的是在代码运行中获取它的上级对象.
var Obj = function()
{
this.child = {
parent: {},
get_parent: function()
{
return this.parent;
}
};
this.init = function()
{
this.child.parent = this;
};
this.init();
}
var o = new Obj;
console.log(o.child.get_parent());