Home  >  Article  >  Web Front-end  >  What does block comment mean in javascript?

What does block comment mean in javascript?

青灯夜游
青灯夜游Original
2022-01-26 15:58:002750browse

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.

What does block comment mean in javascript?

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:

javascript learning tutorial

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn