Here is the full error message:
mlg.html:41 Uncaught TypeError: Cannot set property 'innerHTML' of null
  at ml (mlg.html:41)
  at HTMLButtonElement.onclick (mlg.html:9)
I was making a mad libs game and I was just doing a quick test to find bugs and then I stumbled across this problem. Here is the code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
  <button type="button" onclick="ml()">Mad Libs!</button>
  <p id="display"></p>
  <script>
    function ml() {
      var x = Math.floor((Math.random() * 10) + 1);
      //mad lib 1
      if (x == 1 || 2) {
        document.write("test1");
      }
      //mad lib 2
      if (x == 3 || 4) {
        document.write("test2");
      }
      //mad lib 3
      if (x == 5 || 6) {
        document.write("test3");
      }
      //mad lib 4
      if (x == 7 || 8) {
        document.write("test4");
      }
      //mad lib 5
      if (x == 9 || 10) {
        document.write("test5");
      }
      document.getElementById("display").innerHTML = x;
    }
  </script>
</body>
</html>
 
     
    