Arrow Function

Arrow Functionapp

一、Basic Syntaxthis

  

二、Advanced Syntaxspa

  

三、No binding of thisprototype

  An arrow function does not create its own this context, so this has its original meaning from the enclosing context. Thus, the following code works as expected:3d

  

  without arrow fucntion, you have to write code like this:rest

  

四、Invoked through call or applycode

  Since this is not bound in arrow functions, the methods call() or apply() can only pass in parameters. this is ignored.blog

  

五、No binding of argumentsip

  Arrow functions do not bind an arguments object. Thus, in this example, arguments is simply a reference to the same name in the enclosing scope:get

  

  In most cases, using rest parameters is a good alternative to using an arguments object.

  

六、Arrow functions used as methods,do not have this variable.

  

七、cannot used with new statement

  

八、do not have prototype property

    

參考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

相關文章
相關標籤/搜索