JavaScript Comments 3

Comments In Java Script

Comments are nothing but NON EXECUTABLE Statements.
In Java Scripts comments are classified into two types:
1 Single Line Comment
2 Multi Line Comment

Single Line Comment

A comment which is restricted to only single line is called as Single Line Comment
Always indicated by // double forward slash.

For ex: 

<!doctype html>
<body>
    <pre>
<script type="text/javascript" language="javascript">
     // document.writeln("JavaScript"); Single Line Comment
     document.write("Coding Atharva");
     document.write("ECMA (European Computer Manufacture's Association) Script");
    </script>
    </pre>
</body>

Output:


Multi Line Comment 

A comment which is Applicable to one or more statements.
Indicate by /* */ Forward Slash Asterisk Asterisk  Forward Slash.

For ex: 

<!doctype html>
<body>
    <pre>
<script type="text/javascript" language="javascript">
      document.writeln("JavaScript");
   /*  document.write("Coding Atharva");
     document.write("ECMA (European Computer Manufacture's Association) Script"); Multi Line Comment*/
    </script>
    </pre>
</body>

Output:


Previous
Next Post »