title: Load JavaScript before html page
body: <p>Im learning JS basics and I need to my html page loads before JS if its possible, I`ve tried</p>
  <pre><code>document.addEventListener(&quot;DOMContentLoaded&quot;, function(event) { code here });
  </code></pre>
  <p>But it didnt work, I also tried to put my &quot;script&quot; link in my html body but it didnt change anything, tried to type &quot;defer&quot; in &quot;script&quot;, nothing happened.</p>
  <p>JS code</p>
  <pre><code>var lbs = prompt(&quot;What is the weight in pounds (lbs)?&quot;)
  var kg = pounds * 0.454
  alert(&quot;That is: &quot; + kg + &quot; kilograms&quot;)
  console.log(&quot;Conversion completed&quot;)
  </code></pre>
  <p>HTML code is just a body with simple Lorem text in p tag</p>