Home >Web Front-end >Front-end Q&A >What are the tags in javaScript?
In javaScript, tags are names used by users when programming. They are used to name variables, constants, functions, statement blocks, etc., to establish the relationship between name and use. The first character of a legal tag must be a letter, underscore, or dollar sign, and cannot overlap with JavaScript keywords or reserved words.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
In javaScript, tags, also called identifiers, are names used by users when programming. They are used to name variables, constants, functions, statement blocks, etc., to establish the relationship between name and use. Identifiers usually consist of letters, numbers, and other characters.
Legal markers (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 other positions except the first character. It is generally recommended to use only ASCII-encoded letters, and double-byte characters are not recommended.
cannot have the same name as JavaScript keywords or reserved words. Otherwise, an error will be reported
Note: Tags (identifiers) are case-sensitive
JavaScript is strictly case-sensitive, so Hello and hello are two different things of markers. In order to avoid input confusion and grammatical errors, it is recommended to use lowercase characters to write code. Uppercase forms can be used in the following special cases: 1) It is recommended that the first letter of the constructor be capitalized. Constructors are different from ordinary functions. ExampleThe following example calls the predefined constructor Date(), creates a time object, and then converts the time object into a string and displays it.d = new Date(); //获取当前日期和时间 document.write(d.toString()); // 显示日期2) If a marker consists of multiple words, consider using camel nomenclature - except for the first word, the first letter of subsequent words is capitalized. For example:
typeOf(); printEmployeePaychecks();Tips: The above are general conventions and do not constitute mandatory requirements. Users can name them according to their personal habits. [Related recommendations:
The above is the detailed content of What are the tags in javaScript?. For more information, please follow other related articles on the PHP Chinese website!