Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of JavaScript annotation

Shulou Source: shulou.com Published: 2022-06-01 10:31:08 10月03日 Update

This article introduces the relevant knowledge of "the method of JavaScript annotation". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

JavaScript comments can be used to improve the readability of your code.

JavaScript comment

JavaScript does not perform comments.

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."

JavaScript multiline comment

Multiline comments begin with / * and end with * /.

The following example uses multiple lines of comments to explain the code:

Example

/ *

The following code outputs

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."

This is the end of the content of "JavaScript Annotation method". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Comments code paragraphs output home page multilines explanations methods content readability examples more headings knowledge which is faceted practical learned and then represents Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Apple Huawei Redmi Shulou Information