Home > Article > Web Front-end > What does block comment mean in javascript?
In JavaScript, block comments are represented by "/* */", and the comment content needs to be wrapped with "/*" and "*/". The syntax is "/* comment content */"; it appears in " All content between /*" and "*/" will be regarded as comment content and will be automatically ignored during execution.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
In JavaScript, block comments are also called multi-line comments and are represented by "/* */
". The comment content needs to be expressed in "/*
" and "*/
" package (starting with /*
and ending with */
).
All content appearing between /*
and */
will be regarded as the content of the comment, included between /*
and # Any characters between the ##*/ symbols are treated as comment text and ignored.
Syntax:
/* 注释内容 */Example:
<html> <body> <script type="text/javascript"> /* 下面的代码将输出 一个标题和两个段落 */ document.write("<h1>这是标题</h1>"); document.write("<p>这是段落。</p>"); document.write("<p>这是另一个段落。</p>"); </script> </body> </html>JavaScript comments can be used to prevent execution when testing alternative code.
<html> <body> <script type="text/javascript"> /* document.write("<h1>这是标题</h1>"); document.write("<p>这是段落。</p>"); document.write("<p>这是另一个段落。</p>"); */ </script> </body> </html>【Related recommendations:
The above is the detailed content of What does block comment mean in javascript?. For more information, please follow other related articles on the PHP Chinese website!