JAVASCRIPT COMMENTS
Why write Java script comments?
Java comments, as the name suggests, are notes you write between the programs for various reasons. For example, you may write comments to –
- write information or explanation about the variable, method, class or any statement.
- write text to be available in JavaScript docs.
- hide program code for specific time, etc.
Types of Java script Comments
There are 3 types of comments in JavaScript.
SINGLE LINE COMMENT
Use multi-line comments when you need to add information in source code which exceeds to more than one line. Multi-line comments are used mostly above code blocks which have complex logic that cannot be written in single line.
SYNTAX:
/* Multi line comment */
DOCUMENTATION COMMENT
The documentation comments are used when you want to expose information to be picked up by the javadoc tool. This is the information you see in editors (e.g. eclipse) when using autocomplete feature. These comments are pit above classes, interfaces and method definitions.
SYNTAX:
/** Documentation comment */