Accessing "pseudo-globals" by their name as a string
<p>I am now in the process of removing most globals from my code by enclosing everything in a function, turning the globals into "pseudo globals," that are all accessible from anywhere inside that function block.</p>

<pre><code>(function(){

var g = 1;

var func f1 = function () { alert (g); }

var func f2= function () { f1(); }

})();
</code></pre>

<p>(technically this is only for my "release version", where I append all my files together into a single file and surround them with the above....my dev version still has typically one global per js file)</p>

<p>This all works great except for one thing...there is one important place where I need to access some of these "globals" by string name.  Previously, I could have done this:</p>

<pre><code> var name = "g";
 alert (window[name]);
</code></pre>

<p>and it did the same as</p>

<pre><code> alert(g);
</code></pre>

<p>Now -- from inside the block -- I would like to do the same, on my pseudo-globals.  But I can't, since they are no longer members of any parent object ("window"), even though are in scope.</p>

<p>Any way to access them by string?</p>

<p>Thanks...</p>
