Home>Article>Web Front-end> How to make document comments in javascript
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 "*/".
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:
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:
[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!