Let const summary after learning

A, let const

  1. A variable declared by let const is valid only in the code block in which it resides
  2. There is no variable promotion
  3. There are temporary dead zones
  4. Block-level scope
  5. Const must be assigned when declared
  6. The essence of a const constant is that the memory address to which it points cannot be changed

Block-level scope declaration functions

  1. Equivalent to a variable declared by var
  2. Block-level scoped declarations use function expressions rather than function declarations

Top level object

  1. Var function declares variables that are properties of the top-level object
  2. Let const class declares variables that are not properties of the top-level object

Four, golbalThis

Five, the characteristics of

  1. Let eliminates the need to execute functions anonymously immediately
  2. 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

  1. The difference between the default values of function arguments and the default values of object deconstruction assignments
  2. Parameters with default values are at the end
  3. A function with a default value whose parameters form a separate scope

Rest parameters

  1. Form (… A variable is an array

Arrow function

  1. Arrow functions require no arguments or multiple arguments and use a parenthesis to represent the argument part
  2. Arrow functions that have more than one statement in the code block enclose them in braces and return with a return statement
  3. The this object inside the function is the object at which it is defined, not used
  4. Should not be used as a constructor, that is, the new command should not be used, otherwise an error will be thrown
  5. You cannot use the Arguments object, which does not exist in the function body. If you do, use the REST argument instead
  6. Yield cannot be used, so arrow functions cannot be used as Generator functions

Array extension learning after summary

  1. 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)

  1. Array.from() converts an array-like data structure deployed with the Iterator interface into a true Array
  2. Array.of() converts a set of values to an Array
  3. Array.prototype.copyWithin(target, start = 0, end = this.length)
  4. Array.prototype.find()
  5. Array.prototype.findIndex()
  6. Array.prototype.fill()
  7. Array.prototype.entries() Array.prototype.keys() Array.prototype.values()
  8. Array.prototype.includes()
  9. Array.prototype.flat()