Adding Comments in JavaScript

JavaScript comments are petty much similar to that of CSS. It has two types of comments.

Single line comments are two trailing slashes i.e. //

To implement the single line comment, we simply put the two slashes i.e. // in front of a single line and that line does not execute when JavaScript is run. Instead of placing comments onto every line, it is better to use multi-line comment code.

Multi-line comments are a trailing slash followed by an asterisk /* for opening the comments while an asterisk followed by a trailing slash for closing the comments i.e. */ So the multi-line or with line breaks JavaScript comment is /* Multi line JavaScript coding comment sample where=======================================We have broken the ============================Code into several lines*/

Tip: Do make use of comments because these are really powerful to make a part of code ineffective without actually having to remove it, similarly, it is important to allow a previously un-utilised code to work. 

Read More to the article:

  1. JavaScript Syntax
  2. JavaScript Operators
  3. JavaScript Data Types
  4. JavaScript Variables

External References to Adding Comments in JavaScript:

History of JavaScript

Leave a Reply