For in loop returns a string not an object
<p>I have javascript object that contains nested objects. I want to iterate over these using a 'for in' loop but this returns a string instead of an object?</p>

<p>Code:</p>

<pre><code>var myObject = {


    myNestedObject : {

        key1 : value 1 

    }

}
</code></pre>

<p>And then if i loop:</p>

<pre><code>for(theObject in myObject){

    alert(typeof theObject);

}
</code></pre>

<p>This returns the string 'myNestedObject' but not the object itself.</p>

<p>Why?</p>
