Async
attribute is the Boolean attribute. Async means the script downloads asynchronously while the pages continue to parse.
<head>
<script src="asyncMyJavaScript.js" async onload="GreetUser()"></script>
</head>
<body>
<h1>Hello hello hello, this is async attribute of script element.</h1>
async - The script downloads asynchrnously while the page continue to parse.
<h2>Defer</h2>
The script is executed when the page is finished parsing.
<button onclick="SometOtherFunction()">Click me to test.</button>
</body>
When the page finishes loading, GreetUser() function is called.
Output
Views: 4654 | Post Order: 81