Shorthand way to append multiple dynamic key names to a javascript object
<p>I find myself making (potentially) more work for myself, by having to specify each dynamic key one line at a time.</p>

<p>What I am doing now to add additional keys to an existing object:</p>

<pre><code>create_request[('title_' + id)] = field_data[0];
create_request[('field_' + id)] = field_data[1];
</code></pre>

<p>What I was hoping to be able to do is something like:</p>

<pre><code>jQuery.extend({('title_' + id) : field_data[0], ('field_' + id) : field_data[1]});
</code></pre>

<p>Is there an easier way than what I am doing now (since what I was hoping would work doesn't)? Or is this just a limitation of the language?</p>

<p>Edit for clarity:</p>

<p>Okay, so you can create an object in javascript like this:</p>

<pre><code>{
 a : 1
}
</code></pre>

<p>But that assumes that a is the string value for the key. What if I wanted the key to be the value of a variable?</p>

<p>I could do:</p>

<pre><code>the_object[variable] = 1
</code></pre>

<p>But what if I wanted to do more than one of these dynamic insertions into the object? Is there a convenient way to do that?</p>
