DEV Community

florent giraud
florent giraud

Posted on

[Reminder-2] Arrow Function

I am assuming you are using "use strict"

  • Arrow function syntax is () => {}
  • If you have one parameter you can delete parantheses.
  • If you are doing one action, you can delete the curly braces. () => console.log("hi")
  • It has an implicit return
  • It create a new Scope as Normal function (watch my last reminder if you want more).
  • It doesn't bind context like classic function. That means 'this' will never be bind and will be undefined or window.
  • It cannot act as a constructor like normal function

source: es5 to esnext

Discussion (0)