Multi-line comment (Definition)

Comment blocks that span several lines of script source text.

The character sequence /* introduces a multi-line comment. That comment block is terminated by the next occurrence of the */ character sequence. This means you cannot nest these comments within one another. That is arguably bad coding technique anyway.

If you are used to C language you will most likely have used conditional compilation blocks controlled via the pre-processor. Most implementations of JavaScript do not support this, however one or two recent implementations, especially those that operate outside the context of a web browser, are beginning to introduce many C language like facilities. One of those is the pre-processor with its macro directives. This is particularly useful to developers even though it is somewhat non-standard.

Multiple line comments are replaced with a single line terminator during the interpretation phase. When the /* ... */ does not have a line terminator inside, it is simply removed prior to interpretation of the remaining line content.

Everything between the start and end of a multi-line comment is ignored.


See also:Comment, Comment (// and /* ... */), Lexical convention, Line


ECMA 262 edition 2 - section - 7.3

ECMA 262 edition 3 - section - 7.4

Wrox Instant JavaScript - page - 17