Function arrow (=>)
: Function abbreviated
- No parameters:
() => {}
- A single parameter:
x => {}
- A number of parameters:
(x, y) => {}
- Deconstruction parameters:
({x, y}) => {}
- Nesting: deployment pipeline mechanism
- this point immobilization
- Not because of internal binding
this
mechanism, but it did not ownthis
, resulting in internalthis
is the outer layer of code blocksthis
- Because there is no
this
, and therefore can not be used as a constructor
- Not because of internal binding
Arrow function Mistakes
- Function in the body
this
is定义时所在的对象
not the使用时所在的对象
- Allows
this
point immobilization, this feature is very beneficial to the callback function package - Not as
构造函数
therefore can not use the arrow functionsnew命令
- It can not be used
yield命令
, and therefore can not function as the arrowGenerator函数
- Not available
Arguments对象
, this object does not exist (in a function in vivorest/spread参数
in place) - You must put parentheses around the outside of the object when the object is returned