Multiple-line Comment

To write a multiple line comment in JavaScript, start the comment with /*, followed by the multi-line comment, and at last, end the comment with */.

In the following example, we have a multiple-line comment before the function definition, and inside the function.

</>
Copy
/*
This is a multi-line comment.
This is the second line of the comment.
*/
function printMsg() {
    /* This is 
       also a 
       multiple line comment. */
    alert("Hello World");
}

Conclusion

In this JavaScript Tutorial, we learned how to write multiple-line comments in JavaScript.