One or six data types:
- Number: Integer (octal first is 0, hexadecimal starts with 0x or 0X), floating-point numbers and Nan (non-number) values
- Boolean:js can only indicate its state with true and false, not 1 or 0, but when Boolean values are used in numeric expressions, true and false are automatically converted to 1 and 0
- String: The strings are quoted in single or double quotation marks, and the quotation marks appear in pairs. Backslash defines a number of characters that cannot be displayed
- Object: Includes array type arrays, date objects, and so on
- NULL: If NULL, indicates null or nonexistent
- Undefined: Indicates that the variable has been created but is not assigned a value
Escape characters in JavaScript
| Escape Character |
meaning |
| \‘ |
Single quotation marks |
| \‘‘ |
Double quotes |
| \\ |
Back slash |
| \ r |
Enter |
| \ n |
Switch |
| \b |
Backspace |
| \ t |
Level-making character |
| \f |
Paper Feed |
Second, operators and expressions
Seven Types of operators
- Arithmetic operators: + 、-、 *,/,%, + + 、--(add, subtract, multiply, divide, take surplus, sliding scale 1, decrement 1[7 species])
- Logical operators:&&, | |,! (Logical, logical, or logical counter [3])
- String operator: + (string connection)
- Comparison operators:<, <=, >, >=, = =, = =, =,!== (slightly [8])
- Conditional operator: Operand? result 1: Result 2 (conditional operator, unique three-mesh operator)
- Assignment operators: =, + =,-=, *=,/=,%=, &=, |=, ^=, <<=, >>=, >>>= (slightly [12])
- Bitwise operators: =, &, |, ^, <<, >>, >>> ([7])
Third, program control statements
- If condition statement: if (expression) {statement segment 1;} else{statement segment 2;}
- Switch statement: switch (expression) {case value1; statement Segment 1; Break;case value2; statement Segment 2; Break;...default; statement segment n;}
- For Loop statement: for (initialize loop variable; condition; increment) {Loop statement}
- While Loop statement: while (condition) {Loop statement}
- Do-while Loop statement: do{Loop statement}while (expression)
Note: The Do-while loop executes at least once the loop body; the break statement can jump out of the loop statement; The continue statement can skip the remaining statements within the loop into the next loop; label statements are used to add labels to statements
1.js Basic