Javascript (JSON) Objects: Get Parent

Posted by Dänu on Stack Overflow See other posts from Stack Overflow or by Dänu
Published on 2010-06-05T14:37:26Z Indexed on 2010/06/05 14:42 UTC
Read the original article Hit count: 200

Filed under:
|
|

Hey Guys

I got some question about nested javascript objects (is it me, google or is javascript quite poorly documented?). Now, I got the following (nested) object:

obj: { subObj: { 'hello world' } };

next thing I do is to reference the subobject like this:

var s = obj.subObj;

now what I would like to do, is to get a reference to the object obj out of the variable s. Something like:

var o = s.parent;

Is this somehow possible?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON