How to Write Comments in Javascript

You can write comments in Javascript using the symbols // and /**/. If you want to make single line commented, you have to put the symbol double slash(//) at the start of the line. A multiline comment can be done by using the text inside the start symbol /* and end symbol */

Below are the different ways of writing comments in Javascript with examples.

Write Comments Using Javascript Single Line Comment


You can use symbol // at the start of the line, which you want to make commented. It’s the same way of commenting out a line of code as you use in PHP.

See the example given below.


Click below button to see result.

Write Comments Using Javascript Multi-Line Comment

You can use Javascript multiline comment system to make more than one line commented. Use the symbol /* to the start of the comment and */ to the end of the comment to create a multiline comment system in Javascript.


Click below button to see result.

You must also read.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.