First, the identifier:
1. Case-sensitive
2. Naming 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 letters in the identifiers can also contain extended ASCII or Unicode alphabetic characters (such as À and Æ), but this is not recommended.
- You cannot use keywords, reserved words, true, false, and NULL as identifiers
3. Writing method: It is best to write in the Hump case format, that is, the first letter lowercase, the first letter of each of the remaining words capitalized, but not forced to do so
Ii. notes (two ways)
- Single-line Comment://
- Multi-line Comment:/*......*/
Three, Strict mode: "Use Strict", a compilation instruction, used to tell the JavaScript compiler to switch to strict mode
Four, the statement:
- After the statement, can be omitted, but not recommended
- It is recommended that you use code blocks, even if there is only one statement
Keywords: break, do, instanceof, typeof, Case, else, New, Var, catch, finally, return, void, continue, for, switch, while, Debugger* (New in fifth edition) function, this, with,default, if, throw,Delete, in, try
VI. reserved words: abstract, enum, int, short,Boolean, export, Nterface, static,byte, extends, long, Supe,Char, final, native, synchronized,class, float, package, throws,const, goto, Private, transient,debugger, implements, protected, volatiledouble, import, public, let, yield (fifth edition added)
Keywords and reserved words do not as identifiers, the best name is meaningful naming, can clearly know the meaning of its representative
Eight, variable:
- placeholder, you can save any type of data
- Define variables: Use the var keyword, such as VAR message, to define a message variable
- Initialize variable: message= "HI";
Nine, two ways to define and initialize variables:
- var message= "HI";//contains two steps to define variable var message; Initialize variable message= "HI";
- var message;message= "HI";
JavaScript Advanced Programming Learning Notes Chapter III-Basic concepts