From the course: JavaScript: Best Practices for Code Formatting

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Multi-line syntax with leading asterisks

Multi-line syntax with leading asterisks - JavaScript Tutorial

From the course: JavaScript: Best Practices for Code Formatting

Start my 1-month free trial

Multi-line syntax with leading asterisks

After the opening slash star of a multi-line comment, every character is treated as part of the comment. This means line breaks, spaces, and other characters can be used to format the appearance of the comment and are not treated as control characters by a parser. When you create a multi-line comment with only the comment content between the opening and closing character sets, this is a style known as bare block. Another comment format for creating a multi-line comment is known as starred block. In this format, each line of comment is preceded by a space, an asterisk and another space. This style effectively creates a line to the left of the comment content, underscoring visually the fact that this is a comment and making it stand out even more clearly from the surrounding code. I can update my eslintrc file to specify that I want to use a starred block. I already have a multi-line comment style rule, so I'm just going to…

Contents