JavaScript – Write First Scripting Program

javascript print hello world

JavaScript has it’s own style of writing codes. It requires the <script> </script> tag.

The JavaScript code can be written inside the <script> and </script> tag.

We will talk more about it later. So here is our first JavaScript example to print “Hello World!“.

Here i am writing inside <body></body>. You can write JavaScript code inside <head> or inside <body>.

If you put your JavaScript code above </body> then your web page will load faster.

HTML/ JS Code

<html>
 <head>
  <title> My First JS Document </title>
 </head>
 <body>
  <script language="javascript" type="text/javascript">
  document.write("Hello World!!");
  </script>
 </body>
</html>

Output

  1. JavaScript discards the white spaces, tabs as well as newly created lines in the JS programs.
  2. JavaScript is a case sensitive language.