In JavaScript async and defer is attributes user with script tag during javascript implementation in page.

for example.<script>
. here myscripts.js is java file to add in page.

  • Normal execution
    This is the default behavior of the element. Parsing of the HTML code pauses while the script is executing. For slow servers and heavy scripts this means that displaying the webpage will be delayed.


example <script>

  • Deferred execution
    Simply put: delaying script execution until the HTML parser has finished. A positive effect of this attribute is that the DOM will be available for your script. However, since not every browser supports defer yet, don’t rely on it!


example <script defer>

  • Asynchronous execution
    Don’t care when the script will be available? Asynchronous is the best of both worlds: HTML parsing may continue and the script will be executed as soon as it’s ready. I’d recommend this for scripts such as Google Analytics.


example <script async>