1. Components
-
DOM: The Document Object model, the DOM tree, itself provides a set of methods (APIs) for manipulating page elements.
-
BOM (Browser object model): Browser object models core object (Window loacation).
-
ECMAScript: Specify JS core syntax, JS statements, keywords, reserved words
2. Two types of data
-
Basic data type (simple data type):
string literal type
Number value
Boolean Boolean type (True | false)
Undefined not defined
Null empty (object)
-
Complex data types (composite data types):
Object type
Array type
funcation function type
Date type
Math Object
String Object
Number Object
Boolean Object ...
3. Assignment, equals and congruent description
Assignment (=): Assigns a variable to a specific data;
equals (= =): Only when the comparison determines whether the value is equal;
Congruent (= = =): Comparison of the time not only to compare the data also need to compare types;
Not equal to (! =)
Not all equals (!==)
var str1 = "Let Me fall tears, not only your gentleness"; String type
4. Relational operators
Return value: Boolean type, either True or false, typically used in a judgment statement.
Greater than >
Less than <
Greater than or equal to >=
Less than or equal to <=
5. Logical operators
-
Logical NON (!) Take counter
-
Logical OR
Syntax: expression 1 | | Expression 2
Result: The expression 1, if the expression 1 is true, then return expression 1, if the value of the expression 1 is false, then return the expression 2;
var Resulta = 3 | | 2; 3
-
Logic and (&&)
Syntax: expression 1 && expression 2
Result: If expression 1 is true, return expression 2, return expression 1 if expression 1 is false
var Resulta = 3 && 2; 2
6. Value types and reference types
-
Value type:
String, number, Boolean, undefined
-
Reference type:
Object type
Difference: A value type stores a specific value, and a reference type stores a pointer to a specific address (reference);
Value type of data
-
Value types and assignment of reference types
① Value type assignment:
Copy the stored value (specific data) from the right variable to a variable on the left
② Reference type Assignment:
The right variable stores the stored value (pointing to the address of the specific data) and copies a copy to the left variable
Difference:
Value type assignment is the replication of simple data, they are kept in a relatively independent space, they do not affect each other, the reference type assignment modifies the properties of an object and affects the properties of another object;
Value type assignment:
-
The use of value types and reference types in functions
Related terms within a function
Arguments (actual parameters):
Formal parameter (formal argument): A placeholder variable that has no value when the parameter is not called
function invocation: By default, the value of the argument is assigned to the parameter
Difference: value types are arguments to functions, arguments, and parameters their data are independent of each other. A reference type is an argument to a function, and a formal parameter and an argument share the same data, and modifying one of the objects affects the other.
JS Basic knowledge 1