JavaScript supports the following two different ways of commenting.
- single line comment
- multiple line comments.
Single line comment
- // This is a single line comment.
- Any text between // and the end of the line will be ignored by JavaScript (will not be executed).
Example of single line comments
//This is a single line comment
alert(“We are learning JavaScript single line comment”);
//alert(“Good Morning”);
Multiple line comments
- In JavaScript multi-line comments start with /* and end with */.
- Any text between /* and */ will be ignored by JavaScript.
Example of multiple line comments
/*Multiple line comments start here
alert(“Good Morning”);
Multiple line comments end here*/
alert(“We are learning JavaScript multiple
line comments.”);
Leave a Reply
You must be logged in to post a comment.