Open In App

How to Create a Multi Line Comment in JavaScript ?

Last Updated : 29 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In JavaScript, you can create multi-line comments using the /* and */ delimiters. Everything between these delimiters, regardless of line breaks, is treated as a comment and will not be executed.

/*
This is a multi-line comment
It can span multiple lines
All text between /* and */ is ignored by the JavaScript interpreter
*/

let x = 5;

/*
Multi-line comments are often used for larger blocks of explanations,
documentation, or temporarily excluding multiple lines of code.
*/

In the example above, the content between /* and */ is a multi-line comment. It can span multiple lines, and the JavaScript interpreter will ignore all the text.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads