title: How to update a var in nested objects
body: <p>Say I have an object and I want to set a variable deep nested inside this object, but the var does not yet exist. What's the best way to do this? If I for example have a string that shows where the variable to be updated should be, like below.</p>
  
  <pre><code>var myObject = {};
  var location = "myObject.test.myVar";
  var value = "My value!";
  setValue(location, value, myObject);
  </code></pre>
  
  <p>I want this to result in:</p>
  
  <pre><code>myObject = {
      test: {
          myVar: "My value!"
      }
  };
  </code></pre>
  
  <p>And location can be much deeper than that.
  Any help is appreciated!
  Thanks!
  Andreas</p>