Modern JavaScript: Arrow Functions

New with ES6, we have an additional way to write function expressions in our code – as arrow functions. This new syntax offers 3 main benefits:

  • They are much more concise than regular function expressions/definitions
  • They have implicit returns, which allow us to write single-line expressions (much like we can do with conditionals and the ternary operator)
  • The value of this is lexically bound, meaning that it is not re-bound when you use an arrow function inside of another function – which is very helpful for asynchronous callbacks

Continue reading “Modern JavaScript: Arrow Functions”