Double Variables in Javascript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/592862/javascript-variable-variables">Javascript Variable Variables</a>  </p>
</blockquote>



<p>There's a really handy thing in PHP (that I'm sure is sinful), but I'm looking for the JavaScript alternative.</p>

<p>In PHP I can do this:</p>

<pre><code>$bar = 'var';
$$bar= 'test';

echo $var;
</code></pre>

<p>I am looking for something similiar in JavaScript.
I want to pass a name to a function and initialize a new variable with that name.
So:</p>

<pre><code>function(name) {
    var name = new Function();
}
</code></pre>

<p><strong>Update:</strong>
Ok, here's what I'm trying to do. I know there's an easier way..</p>

<p>I want to use multiple instances of something (let's say plupload for now).</p>

<pre><code>var uploader = new plupload();
</code></pre>

<p>I am loading these dynamically and there will be multiples on a page.
The issue I'm having is that they all have to have a unique name, because I have to be able to call uploader.init(), uploader.refresh(), etc and have each one function independently.</p>

<p>As I said, I'm sure there's a better way.. I'm just not privy to it.</p>
