How do I interpolate a variable as a key in a Javascript object?
<p>If I have:</p>

<pre><code>var a = "whatever";
var b = {a : 20};
alert(b["a"]); // shows 20
</code></pre>

<p>How can I insert the value of the variable <code>a</code> as a key, and not the string "a" ? I want to be able to say: <code>b["whatever"]</code> and have this return 20.</p>

<p>EDIT: a small clarification maybe is in order. Assuming this code:</p>

<pre><code>var a = "whatever";
var b = {a : 20};
</code></pre>

<p>I am asking if it's possible, after the creation of <code>b</code>, to have it contain <code>"whatever":20</code> instead of <code>a:20</code>. Maybe an <code>eval</code> could be used?</p>
