- 2020-03-30 03:03:59
Keywords, variables, function names, and all identifiers must be in the same case (we usually write them in lower case), which is a big difference from the various styles of writing C#.
For example :(take the variables STR and STR as examples)
var str='abc'; var Str='ABC'; alert(str);//The output of ABC
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201405/2014522110754434.png? 201442211829 ">
Unicode escapes sequences
var str='cafu00e9'; var Str='caf e '; alert(Str+' '+str);//You can see that the display is the same. alert (Str===str);//The output of true
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201405/2014522110900860.png? 201442211917 "> < img SRC =" border = 0 / / files.jb51.net/file_images/article/201405/2014522110930607.png? 201442211945 ">
However, it should be noted that Unicode allows multiple methods to encode the same character, as illustrated by the e escape example above:
1. Can be represented by the Unicode character \u00E9
2. Can also be expressed by e\u0301(intonation character)
var str='cafu00e9'; var Str='cafeu0301'; alert(str+' '+Str); //As shown in the figure below, the output of Str and Str is the same alert(Str===str); //The result is the same, but the binary representation is not the same at all, so false is printed
Although according to the result is the same in a text editor, but they cost the same binary code said no, and programming languages will eventually translate into local platform computer machine code (binary codes), the computer can only know the decision by comparing binary encoding, so they are the end result is false
So this is the best explanation of the fact that Unicode allows multiple methods to encode the same character, because the Unicode standard defines a preferred encoding format for all characters in order to convert text into a unified Unicode escape sequence for proper comparison
Again, take e as an example:
Is face the same as e in cafe?