The Definitive Guide to JavaScript Chapter 02 Lexical Structures

Lexical structure

2.1 Character set

JavaScript is written in the Unicode character set and supports almost every language on the planet.

2.1.1 Uppercase and lowercase distinction

JavaScript is an uppercase and lowercase language.

2.1.2 Spaces, newlines and format control characters

JavaScript ignores spaces between tags, newlines, and the readability of code can be greatly improved by spaces and newlines. When spaces and newlines are required, Unicode escapes are used.

2.2 Gaze

single line gaze //here is a single line gaze

multi-line gaze /** multi-line gaze */

2.3 Direct quantity

A quantity that can be used directly in a program, such as a number. String, boolean, etc.

2.4 Identifiers and reserved words

identifier

Variable names must start with a letter (ab...), underscore (_), dollar ($), and non-starting parts can include alphanumeric, underscore, dollar, and other characters.

Javascript variables agree to appear in the Unicode complete set of characters as variable names. Such as: var π=3.14

reserved word


2.5 Optional semicolon

Assuming that the program statements are on each line, the semicolon can be omitted. The semicolon at the end of the program and {} can be omitted.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324772807&siteId=291194637
Recommended