JavaScript - Write First Scripting Program

JavaScript has it's own style of writing codes. It requires the tag. The JavaScript code can be written inside the tag. We will talk more about it later. So here is our first JavaScript example to 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


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

You May Also Like...