Is it possible for a function called from within an object to have access to that object's scope?
<p>I can't think of a way to explain what I'm after more than I've done in the title, so I'll repeat it. Is it possible for an anonymous function called from within an object to have access to that object's scope? The following code block should explain what I'm trying to do better than I can:</p>

<pre><code>function myObj(testFunc) {
    this.testFunc = testFunc;


    this.Foo = function Foo(test) {
        this.test = test;

        this.saySomething = function(text) {
            alert(text);
        };
    };

    var Foo = this.Foo;

    this.testFunc.apply(this);
}

var test = new myObj(function() {
    var test = new Foo();
    test.saySomething("Hello world");
});
</code></pre>

<p>When I run this, I get an error: "Foo is not defined." How do I ensure that <code>Foo</code> will be defined when I call the anonymous function? <a href="http://jsfiddle.net/grzUd/4/" rel="nofollow">Here's a jsFiddle</a> for further experimentation.</p>

<p><strong>Edit</strong>: I am aware of the fact that adding the line <code>var Foo = this.Foo;</code> to the anonymous function I pass in to my instance of <code>myObj</code> will make this work. However, I'd like to avoid having to expose the variable inside the anonymous function--do I have any other options?.</p>
