title: JavaScript append to object using array key/value pair
body: <p>I have an object that I build out dynamically example:</p>
  
  <pre><code>obj = {};
  obj.prop1 = 'something';
  obj.prop2 = 'something';
  obj.prop3 = 'something';
  </code></pre>
  
  <p>With that I now have a need to take an item from an array and use it to define both the equivalent of "propX" and its value</p>
  
  <p>I thought if I did something like </p>
  
  <pre><code>obj.[arr[0]] = some_value;
  </code></pre>
  
  <p>That, that would work for me. But I also figured it wouldn't the error I am getting is a syntax error. "Missing name after . operator". Which I understand but I'm not sure how to work around it. What the ultimate goal is, is to use the value of the array item as the property name for the object, then define that property with another variable thats also being passed. My question is, is how can I achieve it so the appendage to the object will be treated as</p>
  
  <pre><code>obj.array_value = some_variable;
  </code></pre>