Basic concept One, case-sensitive
Everything in ECMAScript (variables, function names, operators) is case-sensitive.
The variable name test and test represent two different variables, respectively.
Second, identifiers
The so-called identifier refers to the name of a variable, function, property, or parameter of a function. One or more characters that are combined by identifiers according to the following formatting rules:
- The first character must be a letter, an underscore (_), or a dollar sign ($);
- Other characters can be letters, underscores, dollar signs, or numbers.
- The ECMAScript identifier is in hump case format, that is, the first letter lowercase, and the first letter of each of the remaining words is capitalized, for example: Firstsecond,mycar,dosomethingimport
Third, comments
ECMAScript uses C-style annotations, including single-line comments and block-level annotations.
- Single-line comment: Start with two slashes such as:
// single-line comment
- Block-level comments begin with a slash and an asterisk (/*), ending with an asterisk and a slash (*/) such as:
/* * This is a multi-line * (Block-level) Comment */
Iv. statements
The statement in ECMAScript ends with a semicolon, and if you omit the semicolon, the parser determines the end of the statement, such as:
var sum = a + b // Even if no semicolon is a valid statement-------does not recommend var diff =-A; // recommended---------Valid statements
Although the ending semicolon is not required, it is recommended that you do not omit it at any time.
V. Keywords and reserved words
Keywords and reserved words: characters that have a specific purpose, which can be used to denote the start or end of a control statement, or to perform a specific operation.
Keywords and reserved words: cannot be an identifier or a property name.
Learn JavaScript II from scratch (basic concept)