title: How do I solve this? "Uncaught TypeError: Cannot read property 'appendChild' of null"
body: <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html lang="en"&gt;
      &lt;head&gt;
        &lt;script&gt;  
        var paragraph = document.createElement("p");    
        var text = document.createTextNode("Boom it is me");    
        paragraph.appendChild(text);
        var element = document.getElementById('text')
  
       element.appendChild(text);
       &lt;/script&gt;        
      &lt;/head&gt;
      &lt;body&gt;
      &lt;style&gt;
      #text{
          color: green;
      }
      &lt;/style&gt;
      &lt;p&gt;Some text&lt;/p&gt;
      &lt;div id="text"&gt;
      &lt;p&gt;Some text2&lt;/p&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p><code>what's the problem of this? Uncaught TypeError: Cannot read property.</code></p>