O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 17. Arrow functions

After reading lesson 17, you will

  • Know how to make your code succinct with arrow functions
  • Know how to maintain context with arrow functions

Arrow functions in JavaScript are directly inspired by the fat arrow functions of CoffeeScript. They behave similarly to CoffeeScript’s by providing a much more succinct way of writing a function expression and also maintaining their context (what this refers to). The syntax isn’t always the same as CoffeeScript’s but they are just as useful and a great addition that makes things like anonymous functions and inline callbacks much more elegant.

Sometimes extraneous syntax can make code much harder for the human mind to parse, because there are several extra pieces to think ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required