Comments in JavaScript:

JavaScript comments are used to make your code more readable also comments are used to debug the code.

There are two types of comments in JavaScript they are as follows:

  • Single Line Comment
  • Multi-Line Comment

Single Line Comment:

In JavaScript to comment a single line you have to use “//” (double backslash) and the whole single line will be commented. The commented code will not be executed by JavaScript and not displayed on browser.


Multi-Line Comment:

You can also comment multiple lines in JavaScript. To comment multiple lines you have to use “/*” and “*/” and the JS code which you want to comment will be written b/w that.


Leave a Reply

Your email address will not be published. Required fields are marked *