Create a new unique global variable each time a function is run in javascript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5117127/javascript-dynamic-variable-name">Javascript dynamic variable name</a>  </p>
</blockquote>



<p>A very basic question.  I want to create a new javascript global variable each time a function is called.  The variable should contain the id of the element so that I can easily access it later.  </p>

<pre><code>id = 2347

//this function would be called multiple times, hopefully generating a new global each time
function (id)
{
var + id = something
// I want a variable that would be named var2347 that equals something, but the above line doesn't get it.
}
</code></pre>

<p>In a later function, I want to access the variable like so:</p>

<pre><code>function two (id)
{
alert(var + id);
}
</code></pre>

<p>I'm sure I'm going to have a "doh!" moment when someone is kind enough to answer this.</p>
