"Javascript authoritative guide" Reading Notes -- Article 2: javascript authoritative guide

Source: Internet
Author: User

"Javascript authoritative guide" Reading Notes -- Article 2: javascript authoritative guide
"Javascript authoritative guide" Reading Notes -- the second authoritative guide of King Kong javascriptjsjavascript

Today is the 196 day of this year. I will share my reading notes.

Chapter 2 lexical structure 2nd 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 Unicode 2.1 and later versions
ES5 must support Unicode 3 and later versions

2.1.1 case sensitive

JavaScript is case sensitive.
HTML is not case sensitive (but XHTML is case sensitive)

2.1.2 space, line break, and format Controller

JavaScript ignores spaces between tokens in the program. In most cases, line breaks are also ignored in JavaScript.
JavaScript recognizes the following characters as line terminator: Line Break (\ u000A), carriage return (\ u000D), line separator (\ u2028), and segment separator (\ u2029 ).
The carriage return and linefeed are resolved together as a single line terminator.

2.1.3 Unicode escape sequence

JavaScript defines a special sequence that uses six ASCII characters to represent any 16-bit Unicode Internal code.
These Unicode escape sequences are all prefixed with \ u, followed by 4 hexadecimal numbers (using numbers and uppercase or lowercase letters ~ F indicates ). This Unicode escape method can be used in JavaScript string direct volume, regular expression direct volume, and identifier (except for keywords ).

"café"===“caf\u00e9” //=>true
2.2 annotations

Single line comment ://
Multi-line comment:

/** Multi-line comment **/
2.3 Direct traffic

The so-called direct volume (literal), the data value directly used in the program
12 // number
'Hi' // a string

2.4 identifier and reserved words

The identifier must start with a letter, underscore (_), or dollar sign ($.
Subsequent characters can be letters, numbers, underscores, or dollar signs (numbers cannot appear as the first character, and JavaScript can easily distinguish between identifiers and numbers ).
For example:
I
My_variable_name
V24
_ Dumy
$ Str

2.5 optional semicolon

Js splits the statement by semicolons.
If the separator is missing, the end of a statement is the start of a One-hop statement, and vice versa.
In js, if each statement excludes one row, the semicolon between statements can be omitted (the semicolon before the end of the program or the right curly braces "}" can be omitted ).

Eg:

var y=x+f(a+b).toString();
x++y

Resolution result: x; ++ y;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.