title: How to set object property (of object property of..) given its string name in JavaScript?
body: <p>Suppose we are only given</p>
  
  <pre class="lang-js prettyprint-override"><code>var obj = {};
  var propName = "foo.bar.foobar";
  </code></pre>
  
  <p>How can we set the property <code>obj.foo.bar.foobar</code> to a certain value (say "hello world")?
  So I want to achieve this, while we only have the property name in a string:</p>
  
  <pre class="lang-js prettyprint-override"><code>obj.foo.bar.foobar = "hello world";
  </code></pre>