JavaScript comments
JavaScript Comments
JavaScript comments can be used to improve the readability of your code.
JavaScript Comments
JavaScript will not execute comments.
We can add comments to explain JavaScript or improve the readability of the code.
Single-line comments begin with //.
This example uses single-line comments to explain the code:
注释:注释不会被执行。
JavaScript multi-line comments
Multi-line comments start with /* Starts with */ and ends with */.
The following example uses multi-line comments to explain the code:
注释:注释块不会被执行。
Use comments to prevent execution
In the following In the example, the comment is used to prevent the execution of one of the lines of code (can be used for debugging):
注释
//这是注释
Use the comment
at the end of the line below In the example, we put the comment at the end of the line of code:
注释:注释不会被执行。