Adding Comments in Javascript

Adding Comments in Javascript:

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 multiline comment code.

Multiline 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 multiline 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. 

Leave a Reply