Defer keyword in the javascript HTML script file
When I began working on JavaScript, I learned about the defer keyword used within the <script> tag. Whenever we generate an HTML file, we often see the defer keyword used in the JavaScript script tag, as shown below.
<script src = “app.js” defer></script>
basically, In HTML, the defer
keyword is used in the script
tag to specify that the JavaScript file should be executed only after the page has finished loading.
This can improve the performance of the page by allowing the browser to continue parsing the HTML while the JavaScript is being downloaded.
The
defer
keyword is only applicable to external scripts and is ignored if used on inline scripts.
Very basic, but we need to know everything available in the HTML script file
Happy learning :)