dynamic (variable) variables (as in php?)
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5187530/variable-variables-in-javascript">&ldquo;Variable&rdquo; Variables in Javascript?</a>  </p>
</blockquote>



<p>I'm thinking surely there is a way to achieve dynamic or variable variables in JavaScript (jQuery)
much as one might in php where we might have...</p>

<pre><code>&lt;?php
$params = array("street", "city", "state","zip_code");
foreach($params as $key) $$key = some_function($key);
echo $city; // would output the result of some_function(city);
?&gt;
</code></pre>

<p>but I can't see a way to accomplish similar in jQuery (JavaScript)
where I would like to have something like...</p>

<pre><code>&lt;script&gt;
params =["street", "city", "state","zip_code"];
jQuery.each(params, function() {
    var var this = jQuery('#'+this).val();
});
alert(city);
&lt;/script&gt;
</code></pre>

<p>Which (<em>of course</em>) doesn't work, but there must be a way?</p>
