If the comment can be contained in one line, we can use
// notation to write the comment. Here, the start of the comment is from
// and the end is at the end of line.
// First line of comment console.log("Hello"); // Comment beside the code
When the comment text spans multiple lines, we can use
/* ... */ to write the comment.
/* Here is a comment that takes more than one line. */
Multi line comment cannot be nested. Let us see what happens if we nest it.
/* Parent comment line /* Child comment line */ */
Above code will throw an error. Because the first
*/ closes the entire comment text so far. So the second
*/ does not have a role and is the reason for syntax error.