Are non-top-level functions members of any object?
<p>I know that top-level functions are members of the <code>window</code> object, and it's consistent with the fact that <code>this</code> inside them refers to the <code>window</code>.</p>

<p>But for non-top level functions, <code>this</code> is still <code>window</code>, but they are not members of <code>window</code>!</p>

<p>Here's some code:</p>

<pre><code>function topLevel1() {
    alert(this)
}

function topLevel2() {
    function inner() {
        alert(this)
    }

    inner()
}

topLevel1()                // alerts DOMWindow
alert(window.topLevel1)    // alerts text of topLevel1, as expected

topLevel2()                   // again, alerts DOMWindow
alert(window.inner)           // undefined
alert(window.topLevel2.inner) // undefined
</code></pre>

<ol>
<li>If <code>inner</code> is neither a member of <code>window</code> nor of <code>topLevel2</code>, whose member is it? </li>
<li>How can it be that it's <code>this</code> is <code>window</code>, but it's not a <code>window</code>'s member? </li>
<li>Isn't it a law in Javascript that if <code>this == owner</code>, then the current method was called via <code>owner.</code>? (except special cases like constructors, <code>apply</code>, <code>call</code>, etc)</li>
</ol>
