Why does assigning `box.content = box` result in `box.content.content` also existing?
07:16 26 Jun 2012

I'm learning JavaScript and there's an example in the book I'm using that I didn't understand. It's like this:

var chineseBox = {};
chineseBox.content = chineseBox;

Then the book lists two expressions and their values. First, "content' in chineseBox; that returns true. Then, the one I don't get, "content" in chineseBox.content which also returns true. I think it'd be more natural if the second expression evaluated to false, pointing to the empty chineseBox object defined earlier. Is there a reason to work like this? What are the practical implications of this feature? And how do I explore deeper levels of the object? Is chineseBox.content.content right?

javascript object