Javascript: Accessing parent properties from inside nested function
<p>How to access <code>somevar:'this is Foo'</code> from inside <code>bar.foo()</code> ?</p>

<pre><code>function Foo(){
    this.somevar='this is Foo';
}
Foo.prototype={
    bar:{
        somevar:'this is bar'
        ,foo:function(){
            console.log(this);
        }
    }
}

var instance = new Foo();
instance.bar.foo();
</code></pre>

<p>Here is link to jsfiddle:
<a href="http://jsfiddle.net/jct8n/3/" rel="nofollow">http://jsfiddle.net/jct8n/3/</a></p>
