Can Javascript be annotated with double slashes
This article mainly introduces whether Javascript can use double slash comments, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
In JavaScript, you can use double slashes to comment; you can use "/ /" to comment on JavaScript code on a single line, the syntax is "/ / single-line comment content", and you can use "/ *" and "* /" to comment on multiple lines of JavaScript code. The syntax is "/ * multi-line comment content * /".
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
Can Javascript be annotated with double slashes?
We can add comments to interpret the JavaScript or improve the readability of the code.
One-line comments begin with / /.
This example uses single-line comments to explain the code:
Example
/ / output title: document.getElementById ("myH1") [xss_clean] = "Welcome to my home page"; / / output paragraph: document.getElementById ("myP") [xss_clean] = "this is my first paragraph."
Multiline comments begin with / * and end with * /.
The following example uses multiple lines of comments to explain the code:
Example
/ * the following code will output a title and a paragraph and will represent the beginning of the home page * / document.getElementById ("myH1") [xss_clean] = "Welcome to my home page"; document.getElementById ("myP") [xss_clean] = "this is my first paragraph." Thank you for reading this article carefully. I hope the article "can Javascript be annotated with double slashes" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!