The Wayback Machine - https://web.archive.org/web/20250405062955/https://www.geeksforgeeks.org/how-to-create-a-multi-line-comment-in-javascript/
Open In App

How to Create a Multi Line Comment in JavaScript ?

Last Updated : 29 Jan, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

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.


Similar Reads

three90RightbarBannerImg