title: Is it possible to add dynamically named objects to JavaScript object?
body: <p>So I was reading the <a href="https://stackoverflow.com/questions/1184123/is-it-possible-to-add-dynamically-named-properties-to-javascript-object">dynamically named properties</a>, which is similar to what I am wanting to do.</p>
  
  <p>I want to pass in an object to be referenced into my object type.</p>
  
  <p>I have a variable in my object that I want to set.</p>
  
  <pre><code>template.format.bold = true;
  </code></pre>
  
  <p>I am wanting to pass in the object along with it's property into a function to set a value.</p>
  
  <pre><code>function setItem(item, value) {
      template[item] = value;
  }
  </code></pre>
  
  <p>Then I want to be call the function:</p>
  
  <pre><code>setItem('format.bold', true);
  </code></pre>
  
  <p>How do I do this?</p>
  
  <p><strong>Error received:</strong></p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'e' of undefined</p>
  </blockquote>