How to set the script to be executed asynchronously in HTML?

HTMLFront End TechnologyWeb Development

Use the async attribute to set the script to execute asynchronously as and when it is available. It only uses the external script.

Firstly, add a js file. Let us give it a name, new.js,

function sayHello() {
   alert("Hello World")

Let’s add the HTML code now and execute the above script −

      <script src = "new.js" ></script>
      <p>This is demo text.</p>
Published on 13-Mar-2018 11:39:39