1. Parameters of a function

1.1 Default Values of Parameters

  • In addition, function arguments cannot be duplicated, and parameter names cannot be declared again inside curly braces
  • When writing code, the default values of parameters should be placed at the end of the argument, and the parameters and arguments should correspond in order.

1.2 Combination with deconstruction assignment

1.3 length attribute

  • The length of the function is the number of arguments without a default value

1.4 scope

1.5 The name attribute of the function

Extension operators and REST parameters

2.1 concept

An extension operator expands an array or class array into comma-separated values

The rest argument is an array of comma-separated values

2.2 Merging Arrays

2.3 Indefinite parameter summation

Arrow function

3.1 ES5 defines functions

3.2 ES6 defines functions

  • => Parameters on the left and function bodies on the right

  • This refers to the object on which it was defined, not the object on which it was called
  • Cannot be used as a constructor
  • Arguments objects cannot be used