Home>Article>Web Front-end> How to make document comments in javascript

How to make document comments in javascript

醉折花枝作酒筹
醉折花枝作酒筹 Original
2021-06-15 16:00:35 4203browse

Javascript document comment method: 1. Use "//" for single-line comments, just add "//" before the specified code; 2. Use "/*" and "*/" for single-line comments. For multi-line comments, just place the specified code between "/*" and "*/".

How to make document comments in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

JavaScript comments are used to explain JavaScript code and enhance its readability.

JavaScript comments can also be used to prevent execution when testing alternative code.

Single-line comments

Single-line comments start with //.

Any text between // and the end of the line will be ignored by JavaScript (will not be executed).

This example uses a single-line comment before each line of code:

   

Effect:

How to make document comments in javascript

Multi-line comments

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

Any text between /* and */ will be ignored by JavaScript.

This example uses multi-line comments (comment blocks) to explain the code:

   

Effect:

How to make document comments in javascript

[Recommended learning:javascript Advanced Tutorial

The above is the detailed content of How to make document comments 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