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>


Leave a Reply

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

  • Get Alert

    Enter your email address:

  • Categories

  • Twitter

Subscribe Now!
Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.

Subscribe Here

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