I. Basics
1 case sensitive
2. Each statement ends with; ends
3 // and/**/is a comment
4 {} defines the statement block. Only one sentence can be omitted. For readability, I usually do not omit it.
5. values can be assigned consecutively.
6. Everything is a variable, including a function.
2. Data Types
1 Value
2 string
3 Boolean (true | false)
4. Object Type (not the following three types: Value Type and reference type)
5 undefined and null
Undifined appears in three cases
- An object is defined, but no value is assigned.
- Access an undefined property of an object
- No value is passed to the function parameter. This type is applicable to the first type.
6 typeof can be used to test the object type typeof x
7. Data type conversion will automatically take place wherever necessary
8. boolean type conversion
Null undefined will be converted to false
0 and Nan will be converted to false
The Null String ''is converted to false.
Other values will be converted to true
!!, Pass !! Convert the following values to boolean values accurately.
Three operators
+-*/% + +-= (Not only the data is the same, but also the data type is equal and rarely used )! ==( Type = )? :