What is the legal identifier of javascript
Today, the editor would like to share with you the relevant knowledge of what the legal identifier of javascript is, the content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.
The legal identifier of JavaScript is expressed as follows: 1, the first character must be a letter, underscore or dollar sign; 2, the identifier can not have the same name with other keywords in JavaScript; 3, other characters in the identifier can be composed of letters, underscores, dollar signs and numbers.
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
What is the legal identifier of javascript
Identifiers: all those that can be named independently in JS can be called identifiers.
For example, variable names, function names, and attribute names all belong to identifiers.
Naming rules for identifiers in the JavaScript language:
Case-sensitive, Myname and myname are two different identifiers.
The first character of the identifier can be an underscore (_), a dollar sign ($), or a letter that begins with a letter, not a number.
Other characters in the identifier can be underscores (_), dollar signs ($), letters, or numbers
Identifiers cannot have the same name as keywords used for other purposes in JavaScript
For example, userName,User_Name,_sys_val, height, $change and so on are all legal identifiers, while the 2mailmairology class is illegal identifiers. Among them, the variable named with Chinese "height" is legal.
Note: the letters in JavaScript are using Unicode,Unicode called unified coding system, which is an international 16-bit coding system, which contains Asian characters, such as Chinese, Japanese, Korean and other characters. All letters in JavaScript can be Asian letters such as Chinese, Japanese and Korean.
These are all the contents of the article "what is the legal identifier of javascript?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.