The <script> tag also supports optional attributes that modify its behavior. For example, the “async” attribute allows the HTML document to continue parsing while the JS file is fetched asynchronously. This can enhance page loading speed, especially for large JS files.
Additionally, the “defer” attribute indicates that the JS file should be executed after the HTML document has finished parsing. This attribute can be useful if your JS code relies on DOM elements or other scripts that load within the HTML document.
FREQUENTLY ASKED QUESTIONS