Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Which is the tag for javaScript?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you which is the marker of javaScript, I hope you will gain something after reading this article. Let's discuss it together.

In javaScript, tokens are names that users use when programming, to name variables, constants, functions, statement blocks, and so on, to establish a relationship between name and use. The first character of a legal marker must be a letter, underscore, or dollar sign and cannot be duplicated with the JavaScript keyword or reserved word.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

In javaScript, markers, also known as identifiers, are names used by users when programming, which are used to name variables, constants, functions, statement blocks, and so on, in order to establish the relationship between name and use. Identifiers usually consist of letters and numbers and other characters.

Legitimate tags (identifiers) should pay attention to the following mandatory rules:

The first character must be a letter, underscore (_), or dollar sign ($).

Unicode characters can be used in places other than the first character. It is generally recommended to use only ASCII-encoded letters, not double-byte characters.

Cannot have the same name as JavaScript keyword or reserved word. Otherwise, an error will be reported.

You can use Unicode to escape sequences. For example, the character a can be represented by "\ u0061".

Note: markers (identifiers) are case sensitive

JavaScript is strictly case-sensitive, so Hello and hello are two different tags.

To avoid typing confusion and syntax errors, it is recommended that code be written in lowercase characters, and uppercase in the following special cases:

1) the first letter of the constructor is recommended to be capitalized. Constructors are different from ordinary functions.

Example

The following example calls the predefined constructor Date (), creates a time object, and then converts the time object to a string to display.

D = new Date (); / / get the current date and time [xss_clean] (d.toString ()); / / display date

2) if the marker consists of multiple words, consider using camel nomenclature-except for the first word, the first letter of the latter word is capitalized. For example:

TypeOf (); printEmployeePaychecks ()

Tip:

The above are all established general habits and do not constitute a mandatory requirement. Users can name them according to their personal habits.

After reading this article, I believe you have a certain understanding of "which is the marker of javaScript". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report