title: Why does firebase.database() throw an error?
body: <p>I tried to make a simple web app that uses firebase database, but following a tutorial, I get an error trying <code>let database = firebase.database()</code>.</p>
  
  <p>The error says that <code>firebase.database is not a function</code>. </p>
  
  <p>I have also tried removing the variable and directly putting <code>firebase.database()</code> into wherever I need to call it, but it also results in the same error.</p>
  
  <p>I have not found any other ways online to resolve this despite looking through firebase documentation.</p>
  
  <p>How can I resolve this? Thanks!</p>
  
  <p>My code (some details removed):</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
  
      &lt;head&gt;&lt;/head&gt;
  
      &lt;body&gt;
  
          &lt;!-- The core Firebase JS SDK is always required and must be listed first --&gt;
          &lt;script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"&gt;&lt;/script&gt;
  
          &lt;!-- TODO: Add SDKs for Firebase products that you want to use
       https://firebase.google.com/docs/web/setup#available-libraries --&gt;
          &lt;script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-analytics.js"&gt;&lt;/script&gt;
  
          &lt;script&gt;
          // Your web app's Firebase configuration
          var firebaseConfig = {
              apiKey: "AIza***********************************",
              authDomain: "databasetest-db3.firebaseapp.com",
              databaseURL: "https://databasetest-db3.firebaseio.com",
              projectId: "databasetest-db3",
              storageBucket: "databasetest-db3.appspot.com",
              messagingSenderId: "9472********",
              appId: "1:947************************************",
              measurementId: "G-EZ9*******"
          };
  
          // Initialise Firebase
          firebase.initializeApp(firebaseConfig);
          firebase.analytics();
          let database = firebase.database()
  
          function writeData() {
              database.ref("User").set({
                  name: document.getElementById("nameField").value,
                  age: document.getElementById("ageField").value,
              })
          }
          &lt;/script&gt;
          &lt;h1&gt;User Database&lt;/h1&gt;
          &lt;input type="text" placeholder="name" id="nameField"&gt;
          &lt;input type="text" placeholder="age" id="ageField"&gt;
          &lt;button onclick="writeData()"&gt;Submit&lt;/button&gt;
  
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Edit: code copied and pasted instead of image</p>