First, JS Basic classification
1. Constants
1.1 Integer constants: Binary Conversions (number.tostring (16)--parentheses are converted into several binary);
1.2 Real-type constants
1.3 Boolean value: True and false, lowercase;
1.4-Character constants: single and double quotes;
1.5 null: null--The value of the non-existent quantity returns null;
1.6 Special characters: non-realistic special characters with/start for control characters;
Second, the variable: mainly used as access data, to provide information storage container, divided into global variables and local variables.
2.1 Attention Points
2.11 variable name valid, must start with a caption, the middle can have numbers and underscores (_), no space +-comma or other symbols;
2.12 cannot use the keyword in JS as the variable name;
2.13 variables must be declared before using Var;
Third, operator
3.1 Arithmetic operators: Add, subtract, multiply, divide, take surplus (%), take counter-, take complement ~,++ sliding scale,--decrement;
3.2 comparison operator (result true or false):>, <, >=, <=, = =,! =;
3.3 Logical operators:! Take anti-,&& with, | | Or
3.4 String arithmetic;
Iv. Expressions: A collection of operators
V. BASIC statements
5.1 If-else Conditional statement
The format is: if (expression) {
Execute statement 1;
}else{
EXECUTE statement 2;
}
5.2 For Loop statement
Format: for (start condition; termination condition; variable change) {
Execute the statement;
}
5.3 Break statement: Jump out of a for or while
5.4 Continue statement: End the current loop and go to the next loop
5.5 Switch statement:
Format: switch (expression) {
Case value 1;
Statement 1;
Break
Case value 2;
Statement 2;
Break
。。。
Default
Statement N;
}
Vi. functions
JavaScript Basic Learning