JavaScript is a programming language of web. It is quite lightweight and executes in the browsers of the webpage.
Often you have seen popup window appearing once you click a button in a webpage. That is JavaScript in the background, which is making the popup appear.
Let us write our first JavaScript Application which just prints Hello World on the screen.
<html>
<body>
<script language = "javascript" type = "text/javascript">
document.write("Hello World")
</script>
</body>
</html>
document.write("Hello World")<html> <body> .... .... </body> </html>
<script language = "javascript" type = "text/javascript">
document.write("Hello World")
</script>Since, document.write("Hello World") is inside the <script> tag, it got printed.
We have to write all our codes inside the <script> tag. And the <script> tag should be inside <html> and <body> tags.
<html>
<body>
<script language = "javascript" type = "text/javascript">
document.write("Hello World")
</script>
</body>
</html>