src attribute is used to specify the external JavaScript file location as “async_demo.js”.
async attribute is used to set the file parsing “async_demo.js” as asynchronously.
Output for async Attribute in HTML:
The output shows the <h2> element (“Welcome to Wikitechy!”) and the alert message (“Hello wikitechy!”). Because the async attribute is set so the contents are loading asynchronously.
If the async attribute not set the content loading synchronously so the content of <h2> is not loaded.