Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

How to comment javascript code?

Ads

 
 

Share on Google+Share on Google+

samar
How to comment javascript code?
1 Answer(s)      6 years and 8 months ago
Posted in : JavaScript Questions

How to comment javascript code?

Ads
View Answers

November 10, 2010 at 11:43 AM


Comments can be added to explain the JavaScript, or to make the code more readable. With comments, you can add extra information pertaining to your code. Comments are ignored (i.e., are not processed as coding instructions) by the computer.

  1. Single-line comments- Single-line comments start anywhere in the line and continue to the end of the line. Single-line comments begin with a double forward slash (//),

For example-

// Description: This JavaScript code prints a simple message.
  1. Multiline comments- Multiline comments span multiple lines. Multiline comments start with slash-asterisk (/*) and end with asterisk-slash (*/) pair. For example,

    /* Author: Scripting Master Description: This JavaScript code prints a simple message.*/


Ads