HTML Fundamentals

  1. The <script> HTML element is used to embed executable code
  2. This is typically JavaScript


defer: This boolean attribute indicates to browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded.

The script tag should either be included
  1. Between the <head> tags
  2. Just before the closing <body> tag

JavaScript is often placed before the closing body tag to help reduce the page loading time. Doing this allows the rest of the page to load before loading the JavaScript files, which can be large


<script src="javascript.js"></script>
<script type="text/javascript" src="javascript.js"></script>
<script src="javascript.js"></script>
  alert("Hello World!");


(scr)ipt is src