Let const summary after learning
A, let const
- A variable declared by let const is valid only in the code block in which it resides
- There is no variable promotion
- There are temporary dead zones
- Block-level scope
- Const must be assigned when declared
- The essence of a const constant is that the memory address to which it points cannot be changed
Block-level scope declaration functions
- Equivalent to a variable declared by var
- Block-level scoped declarations use function expressions rather than function declarations
Top level object
- Var function declares variables that are properties of the top-level object
- Let const class declares variables that are not properties of the top-level object
Four, golbalThis
Five, the characteristics of
- Let eliminates the need to execute functions anonymously immediately
- Let and for are used together
Structure assignment is summarized after learning
Array destruct assignment
Object structure assignment
{mode: variable} = {a: 1} a Mode 1 variable
3, structure assignment, (=) is not an array object, first convert it into an object, then deconstruct the assignment
4. Deconstruction and assignment of function parameters
Destruct assignments can be set to default values
Six, use 7 points
Function extension learning after summary
Default values for function parameters
- The difference between the default values of function arguments and the default values of object deconstruction assignments
- Parameters with default values are at the end
- A function with a default value whose parameters form a separate scope
Rest parameters
- Form (… A variable is an array
Arrow function
- Arrow functions require no arguments or multiple arguments and use a parenthesis to represent the argument part
- Arrow functions that have more than one statement in the code block enclose them in braces and return with a return statement
- The this object inside the function is the object at which it is defined, not used
- Should not be used as a constructor, that is, the new command should not be used, otherwise an error will be thrown
- You cannot use the Arguments object, which does not exist in the function body. If you do, use the REST argument instead
- Yield cannot be used, so arrow functions cannot be used as Generator functions
Array extension learning after summary
- The spread extension operator, the inverse of REST, converts an array to a comma-separated sequence of arguments
The rest argument is assigned (= left) and the spread operator (= right)
- Array.from() converts an array-like data structure deployed with the Iterator interface into a true Array
- Array.of() converts a set of values to an Array
- Array.prototype.copyWithin(target, start = 0, end = this.length)
- Array.prototype.find()
- Array.prototype.findIndex()
- Array.prototype.fill()
- Array.prototype.entries() Array.prototype.keys() Array.prototype.values()
- Array.prototype.includes()
- Array.prototype.flat()