Javascript create variable from its name
<p>In PHP we can do this:</p>

<pre><code>$variable = "name_of_variable";
$this-&gt;{$variable} = "somevalue";
</code></pre>

<p>how to do this in javascript?</p>

<p>where use case should look like:</p>

<pre><code>function Apple(){
    var name = "variable_name";
    this.(name) = "value";
}
console.log(new Apple());
</code></pre>

<p>to output</p>

<pre><code>[Apple: {variable_name:"value"}]
</code></pre>
