In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "what are the comments in javascript", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the notes in javascript" this article.
There are two kinds of comments in javascript: 1, the single-line comment character "/ /", which is only valid on the line, and all the content after "/ /" will be regarded as the content of the comment; 2, the multi-line comment character "/ * /", all the content that appears between "/ *" and "* /" will be regarded as the content of the comment.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
In javascript, comment code is divided into multi-line comments and single-line comments
Single-line comments: use "/ /" for single-line comments; all content after "/ /" will be regarded as the content of the comment and will not affect the content before "/ /".
Multiline comments: use "/ * /" for multiline comments; everything that appears between "/ *" and "* /" is treated as the content of the comment.
The basic structure is as follows:
Single-line comment
/ / I am the commented out text, here can also be the js code
Multiline comments:
/ * I am the commented out text and I pretend to be the commented out js code * /
The method of single-line comments in js
In js code, use the "/ /" symbol to comment out a single line of code or add a description of the code.
Example 1: comment out a single line of code
Js Code:
/ / [xss_clean] (''); [xss_clean] ('https://www.php.cn/');
Example 2: add a description to each line of code
Js Code:
Var a = 1; / / declare a variable await variables; / / add 1 [xss_clean] (a) to the variable; / / output this variable
The method of multiline comments in js
In js code, use / * and * / symbols to comment out multiple lines of code.
Example 1: comment out multiple lines of js code
Js Code:
The code here is commented out of var a = 1 position bank *; [xss_clean] (a); * / a = a + 5 position console.log (a)
Add multiple lines of code description to the example 2:js code
Js Code:
/ * here is an illustration of the following code. I'm just giving a simple example * / var a = 1x a = a + 5x console.log (a)
Supplementary note:
In some dedicated code editors, such as "VScode", "Notepad++", etc., the colors of normally executed code and commented-out code are different and can be easily distinguished.
Take the 'vscode' editor as an example, as shown in the following figure
Description:
1. The font of the commented out code or description is green
2. The normal code is white or other colors
3. Due to editor or personal settings, the code color in the code editor will be different.
The above is all the content of the article "what are the comment symbols in javascript"? thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.