In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces javascript how to carry out single-line comments and multi-line 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.
The method of single-line comment: use the "/ /" character, syntax "/ / comment content", and all characters in the line after the "/ /" character will be ignored and no longer parsed. Multiline annotation method: using "/ *" and "* /" characters, syntax "/ * comment information * /", any characters contained between "/ *" and "* /" symbols will be ignored and no longer parsed.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
A comment is a string of characters that are not parsed. JavaScript does not perform comments. We can add comments to interpret the JavaScript or improve the readability of the code.
There are two ways to comment on JavaScript:
Single-line comment: / / single-line comment information.
Multiline comment: / * multiline comment information * /.
1. JavaScript makes single-line comments
Treat all characters on the line after the / / character as a single-line comment message. The following comment statements can be located in different locations of the code snippet to describe the functionality of the code in different areas.
/ / Program description function toStr (a) {/ / Block description / / Code snippet description return a.toString (); / / statement description}
When using single-line comments, any characters or code on the same line after / / are ignored and no longer parsed.
2. JavaScript makes multi-line comments
Multiline comments begin with / * and end with * /.
/ * 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 blog"; document.getElementById ("myP") [xss_clean] = "this is a welcome paragraph." / * * jQuery JavaScript Library v3.3.1 * https://jquery.com/* Includes Sizzle.js* https://sizzlejs.com/* Copyright JS Foundation and other contributors* Released under the MIT license* https://jquery.org/license* Date: 2019-08-21 T 17:24 Zero /
In multiline comments, any characters contained between the / * and * / symbols are ignored as comment text.
Thank you for reading this article carefully. I hope the article "how to make single-line comments and multi-line comments in javascript" shared by the editor will be helpful to you. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.