Online

JavaScript Comments

JavaScript comments can be used to explain JavaScript code, and to make it more readable. JavaScript comments can also be used to prevent execution, when testing alternative code.

Single Line Comments

Single line comments start with //.Any text between // and the end of the line will be ignored by JavaScript (will not be executed).This example uses a single-line comment before each code line:

Example :-

Result

My first paragraph.

Multi-line Comments

Multi-line comments start with /* and end with */.Any text between /* and */ will be ignored by JavaScript. This example uses a multi-line comment (a comment block) to explain the code:

Example :-

Result

My first paragraph.