How to Write Comments in Javascript (Single and Multiline)

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

Syntax

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.

Output

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.

Output

Click below button to see result.


You must also read.

THE ULTIMATE TOOLKIT

Get FREE Access to Toolkit and Resources that we are using in Tutorialdeep that Every Professional Should Have! in one handy PDF.

Get the PDF

Leave a comment

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.


Download Link Will be Send to Your Email id