Home >Web Front-end >JS Tutorial >How to comment multiple lines in javascript

How to comment multiple lines in javascript

青灯夜游
青灯夜游Original
2021-04-09 13:35:529807browse

Multi-line comments "/**/" to comment multi-line statements, syntax "/*Multi-line comment information*/" can be used in javascript. In a multi-line comment, any characters contained between the "/*" and "*/" symbols are treated as comment text and ignored. Comments are explanations and explanations of the code, and their purpose is to make it easier for people to understand the code.

How to comment multiple lines in javascript

The operating environment of this tutorial: Windows 7 system, ECMAScript version 5, Dell G3 computer.

Comments are explanations and explanations of the code, and their purpose is to make it easier for people to understand the code. Comments are when the programmer writes an explanation or hint for a statement, program segment, function, etc., which can improve the readability of the program code.

JavaScript multi-line comments

Multi-line comments start with /* and end with */.

Syntax:

/*多行注释信息*/

Example:

<script type="text/javascript">
/*下面的代码将输出:
* 一个标题和两个段落
*/
document.write("<h1>This is a header</h1>");
document.write("<p>This is a paragraph</p>");
document.write("<p>This is another paragraph</p>");
</script>

in a multi-line comment, enclosed in /* and */ symbols Any characters between are treated as comment text and ignored.

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of How to comment multiple lines 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