Home > Web Front-end > JS Tutorial > body text

How to comment multiple lines in javascript

青灯夜游
Release: 2023-01-04 09:35:39
Original
9702 people have browsed it

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:

/*多行注释信息*/
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!