JavaScript code use in following :
- Between the body tag of html
- Between the head tag of html
- In .js file (external javaScript)
1. JavaScript use between html body tag :
Example of javaScript using inside html between body tag.
Output :- Hello World
2. JavaScript use between head tag in html :
Example to use javaScript between head tag in html.
Output :

3. External JavaScript file :
We can create external JavaScript file and embed it in many html page. If you want to run the same JavaScript on several pages in a web site, you should create an external JavaScript file, instead of writing the same script over and over again.
message.js
index.html

Latest posts by vikashdev k (see all)
- PHP OOP: Traits - October 25, 2021
- PHP OOP: Late Static Binding - October 25, 2021
- PHP OOP : Static Members - October 23, 2021