Skip to content
doubtly

1 answer

There are two ways we can include javascript code in the HTML

  • Embedded Js: In this, we add the script tag directly in the HTML document as shown below:

<script> document. Write (“Welcome!”)</script>

Can add the script tag either in the head section of the body section of an HTML document depending on when you want the script to be loaded

  • External Js: create a separate javascript file and save it with .js extension and with the help of src attribute of script tag add the .js file to the HTML document as shown below:

<script src=”file1.js”></script>

codelikepro · 19 Aug 2022 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.