Arrow Function

1、Basic Syntax

  Arrow Function

2、Advanced Syntax

  Arrow Function

3、No binding of this

  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:

  Arrow Function

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

  Arrow Function

4、Invoked through call or apply

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

  Arrow Function

5、No binding of arguments

  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:

  Arrow Function

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

  Arrow Function

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

  Arrow Function

7、cannot used with new statement

  Arrow Function

8、do not have prototype property

  Arrow Function  

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2021-09-23
  • 2021-06-19
  • 2021-06-30
  • 2021-06-22
猜你喜欢
  • 2021-09-25
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
相关资源
相似解决方案