title: Adding nested map values to firestore
body: <p>I'm pretty new to javascript and also firestore. I'm trying to add some values to the database which are generated from an input form.</p>
  <p>I have the following values taken from the form:</p>
  <p>Ingredient: Corriander
  Measure: Cups
  Amount: 1</p>
  <p>So I wanted to have the structure:</p>
  <p>ingredients: {ingredient: {Corriander: {amount:1, type:'cups'}}}</p>
  <p>However, when I try and use my variables:</p>
  <p>ingredients: {ingredient: {ing: {amount:am, type:mea}}}</p>
  <p>The amount and measure values work fine, but the ingredient value enters into the database as &quot;ing&quot; and not the value &quot;Corriander&quot;.</p>
  <p>Here is my javascript:</p>
  <pre><code>
      const generateTemplate = (ing, am, mea) =&gt; {
    const html = `
  
      &lt;li class=&quot;list-group-item&quot;&gt;&lt;span&gt;${am} &lt;/span&gt;&lt;span&gt;${mea}&lt;/span&gt; of &lt;span&gt;${ing}&lt;/span&gt;&lt;i class=&quot;far fa-trash-alt delete&quot;&gt;&lt;/i&gt;&lt;/li&gt;
  
    `;
    list.innerHTML += html;
  
  
   // console.log(ing);
    const newIng = {
      //user: userID,
      //name: recipeName,
      ingredients: {ingredient: {ing: {amount:am, type:mea}}},
      //created_at: firebase.firestore.Timestamp.fromDate(now),
    };
  console.log(newIng);
  
          db.collection(&quot;recipes&quot;)
   .add(newIng)
  .then(() =&gt; {
    console.log(&quot;ing added&quot;);
  })
  .catch((err) =&gt; {
    console.log(err);
  });
  
  };
  </code></pre>