In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how JavaScript uses annotations to prevent execution". Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how JavaScript uses annotations to prevent execution.
JavaScript comments are used to interpret JavaScript code and enhance its readability.
JavaScript comments can also be used to block execution when testing alternative code.
Single-line comment
One-line comments begin 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:
Example
/ / change the title:
Document.getElementById ("myH") [xss_clean] = "my first page"
/ / change the paragraph:
Document.getElementById ("myP") [xss_clean] = "my first paragraph."
This example uses a single-line comment at the end of each line to explain the code:
Example
Var x = 5; / / declare x, assign it a value of 5
Var y = x + 2; / / declare y, assign it a value x + 2
Multiline comment
Multiline comments begin with / * and end with * /.
Any text between / * and * / will be ignored by JavaScript.
This example uses multiline comments (comment blocks) to explain the code:
Example
/ *
The following code will change
In the web page
Title of id = "myH"
And the paragraph id = "myP":
, /
Document.getElementById ("myH") [xss_clean] = "my first page"
Document.getElementById ("myP") [xss_clean] = "my first paragraph."
Comments: it is most common to use single-line comments.
Tip: comment blocks are often used for official declarations.
Use comments to prevent execution
Using comments to prevent code execution is suitable for code testing.
Adding / / before a line of code changes the executable line of code to a comment.
This example uses / / to prevent the execution of lines of code:
Example
/ / document.getElementById ("myH") [xss_clean] = "my first page"
Document.getElementById ("myP") [xss_clean] = "my first paragraph."
This example uses comment blocks to prevent the execution of multiple lines of code:
Example
/ *
Document.getElementById ("myH") [xss_clean] = "my first page"
Document.getElementById ("myP") [xss_clean] = "my first paragraph."
, /
At this point, I believe you have a better understanding of "how JavaScript uses annotations to prevent execution". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.