Javascript Syntax

Javascript is placed between two <script> and </script> while writing HTML documents.

  • Syntax:

Javascript can be placed anywhere in HTML but it is recommended to keep it in between <head> and </head> tags.

Javascript can also be written in other file but one needs to mention connectors.

When one mentions <script> tags browser understands that given script is javascript but it is recommended to mention these.


  • <script language="javascript" type="text/javascript">

Case sensivity in javascript

Javascript is a case sensitive language unlike HTML if you mention any thing in capital letters or small letters entire script becomes completely different thing.

Comments in javascript

Comments in javascript can be placed after //.Any thing written after this is neglected by browser and it never appears in output.

Example of javascript

<!DOCTYPE html>
document.write("HELLO JAVASCRIPT")