How can I use a key value as a variable name in JavaScript?
<p>I want to be able to take JSON into my program and then create objects based off of that data. So, I want to create objects where the name of that object is the value stored in a key value pair. For instance, if I had the following JSON (and I know this isn't perfect JSON):</p>

<pre><code>{
    "objectName" : "**variableName**",
    "someDataName" : "thatData",
    "someOtherDataName" : "thisData"
}
</code></pre>

<p>Then I want to be able to make an object like this:</p>

<pre><code>function myObject(thatData, thisData) {
    this.name = name;
    this.thatData = thatData;
}

var **variableName** = new myObject(thatData, thisData);
</code></pre>

<p>The key here is that I want to be able to use the value stored in the ObjectName key value pair as the variable name for the object. Is this even possible? I have been looking for how to do this for a while now. I believe that this is different than <a href="https://stackoverflow.com/questions/5187530/variable-variables-in-javascript/37575407#37575407">&quot;Variable&quot; variables in Javascript?</a> because I am trying to use a value in a key value pair to name my objects. </p>