javascript: this keyword
<p>I know <code>this</code> points to current object on which function operates. So here is the code as per the definition</p>

<pre><code>function foo(){
    alert(this); //output==window
}
</code></pre>

<p>So, now function foo is equal to window.foo()
but now here</p>

<pre><code>function foo(){
    function fo(){
        alert(this);
    }
    fo();
}
</code></pre>

<p>so,now when <code>foo</code> gets executed output is again window object why? since the         nested <code>this</code> should refer to different object.since fo() is now not operating on window object as foo()==window.foo() .so nested function should now point to different object</p>

<p>see here for detail:</p>

<pre><code> function foo()
{
alert(this);
  function fo(){alert(this);}
as();
}
</code></pre>

<p>if now,var x=new foo();than "this" within the foo() method points to object object but the nested this points to global object right?now u should be clear what i meant to say</p>
