You can write your javascript inside the script tag. Your script tag can be placed everywhere within the HTML tag but you are recommended to keep the script tag within the head tag.
The script tag may contain two important attributes. They are Language and Type.
To the opening of the script tag, you can show the language as javascript but it is not compulsory as it phased out with the development of new versions of HTML. It can be written as language="javascript".
The type attribute indicates the scripting language in use which identifies the content between the script tag.
The type attribute can be written as shown here, type="text/javascript". As the text/javascript became outdated, it had replaced with the application/javascript. So it can be written as type="application/javascript". However, the "type" attribute is optional upon the introduction of HTML5.
So in short, both the attributes (Language & Type) are optional in the new versions of HTML.
In this video, you will learn how to write your first javascript with the document.write and alert message onlick.
▶Subscribe my YouTube channel at http://bit.ly/sub815
▶Visit my blog at http://v815.blogspot.com
▶Like my Facebook Page at https://facebook.com/sirchogyal
Follow me on:
❀Twitter: https://twitter.com/sirchogyal
❆Instagram: https://www.instagram.com/sirchogyal