title: Is it necessary to put scripts at the bottom of a page when using the "defer" attribute?
body: <p>I always put my script tags at the bottom of the page since it's good practice to load scripts after things like HTML/CSS and text has finished loading. I just found out about the defer attribute which basically does the same thing, that is it waits till the page has finished loading before fetching and executing scripts.</p>
  
  <p>So if using the defer attribute is it necessary to physically place script tags at the bottom of the page vs inside the head tag?</p>
  
  <p>I find it better for readability to keep script tags inside the head section.</p>
  
  <pre><code>&lt;script src="script.js" defer="defer"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;script defer="defer"&gt;
  
  // do something
  
  &lt;/script&gt;
  </code></pre>