title: Pass parameter at the end of a dot string
body: <p>I'm trying to make a function to get one field from a firebase database</p>
  
  <pre><code>function getFromDatabase(param1) {
      firebase.auth().onAuthStateChanged(function (user) {
          if (user) {
              console.log(user)
              db.collection("users").doc(user.uid).get().then(function (doc) {
                  if (doc.exists) {
                      console.log(doc.data().name) //Passes expected value
                      console.log(doc.data().param1)
                  } else {
                      console.warn("No such document!");
                  }
              })
          }
      })
  }
  </code></pre>
  
  <p>when I call</p>
  
  <p><code>getFromDatabase(name)</code> </p>
  
  <p>I would like it to return</p>
  
  <p><code>console.log(doc.data().name)</code></p>
  
  <p>but it doesn't interpret it as a parameter</p>
  
  <p>I've tried a whole bunch of different variations of <code>console.log(doc.data().param1)</code>, but I can't figure this out for the life of me, and it might be because I don't know the correct term to search for, as everything I know is from internet searches.</p>
  
  <p>If anyone could provide insight on what im doing wrong, I would greatly appreciate it.</p>