In this tutorial we will learn about script tag.
We use the script tag to tell the browser the starting and ending point of a script inside the HTML document.
In the following example we are using the noscript tag.
In the following example we are going to use the console.log() method to print the famous "Hello World!" text in our browser console.
Open your favourite text editor or IDE and create a html file and name it helloworld.html.
Now inside this file write the following HTML.
Now open the helloworld.html file in the browser and open Console.
Chrome: View -> Developer -> Developer Tools
Firefox: Tools -> Web Developers -> Web Console
Safari: Developer -> Show Error Console
Or, simply right click on the page and select Inspect / Inspect Element and then click on the Console tab.
Once you are in the Console tab you will see the following output.
And then include the js file inside the helloworld.html file using the script tag. And when the html file will be opened in the browser it will give us the same result.
Have fun learning :-)
Copyright © 2014 - 2023 DYclassroom. All rights reserved.