ES6 study notes

Learning materials: http://es6.ruanyifeng.com/#docs/function 

 

1. This in the arrow function refers to the scope at the time of definition rather than the scope of runtime. The reason is that arrow functions do not have their own this

2. The three variables of arguments, super, and new.target do not exist in the arrow function. They all refer to the corresponding information of the outer function at the time of definition.

3. You cannot use call(), apply(), bind() to change the point of this in arrow functions.

4. The rest parameter can now be used in function parameters, in the form of "...variable_name". The rest parameter must be the last parameter of the function. Using the rest parameter can pass in any number of parameters, and the parameter variable is a real array.

5. Parameters with default values ​​should be placed at the end of the function parameter list, otherwise it cannot really be omitted unless undefined is explicitly entered.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326391085&siteId=291194637