"JavaScript authoritative guide" Reading notes--second javascriptjsjavascript authoritative guide
Today is 196 days this year, share today's reading notes.
2nd Chapter Lexical Structure 2.1 character set
JavaScript programs are written in the Unicode character set.
Unicode is a superset of ASCII and Latin-1 and supports almost all languages.
ES3 requires support for Unicode 2.1 and subsequent versions
ES5 requires support for Unicode 3 and subsequent versions
2.1.1 Case Sensitive
JavaScript is case-sensitive.
HTML is not case-sensitive (but XHTML is case-sensitive)
2.1.2 spaces, line breaks, and format controls
JavaScript ignores spaces between tokens in the program. In most cases, JavaScript also ignores line breaks.
JavaScript recognizes the following characters as line terminators: line Break (\u000a), carriage return (\u000d), line delimiter (\u2028), segment Separator (\u2029).
A carriage return and a newline character are resolved together into a single-line terminator.
2.1.3 Unicode escape sequence
JavaScript defines a special sequence that uses 6 ASCII characters to represent any 16-bit Unicode inner code.
These Unicode escape sequences are prefixed with \u followed by 4 hexadecimal digits (denoted by a number and uppercase or lowercase letters a~f). This Unicode escape notation can be used in JavaScript string literals, direct amounts of regular expressions, and identifiers (except for keywords).
"café"//=>true
2.2 Notes
Single-line Comment://
Multi-line Comments:
/** 多行注释**/
2.3 Direct Volume
The so-called direct volume (literal), the data value that is used directly in the program
12//Number
' Hi '//a string
2.4 Identifiers and reserved words
Identifiers must begin with a letter, an underscore (_), or a dollar ($) character.
Subsequent characters can be letters, numbers, underscores, or dollar characters (numbers are not allowed to appear as first characters, and JavaScript can be easily separated by identifiers and numbers).
Such as:
I
My_variable_name
V24
_ Dumy
$str
2.5 Optional semi-colons
JS uses a semicolon (;) to split the statement apart.
Missing delimiters, the end of a statement is the start of a scare-jump statement, and vice versa.
In JS, if the statement has a separate line, you can usually omit the semicolon between the statements (the semicolon can be omitted before the end of the program or the closing curly brace "}").
eg
var y=x+f(a+b).toString();
x++y
Analytic result: x;++y;
The JavaScript authoritative guide reading notes--second article