5.2 JavaScript Comments

Comments can be added to explain the JavaScript, or to make it more readable

Single line comments start with//.

Multi line comments start with/*and end with*/.

This example uses a multi line comment to explain the code:

<html> <head>
<script type = “text/javascript”>
//this is a single line comment
The code below will write
One header and two paragraphs */
Document.write (“<h1>This is a header</h1>”);
Document.write(“<p> This is a paragraph </p>”);
Document.write(“<p>This is another paragraph</p>”);
<body> </body>


Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

eight × 1 =

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter