Arrow Functions

In ES6 there is a new function syntax. There are some nuances to the syntax that we will be going over.

Before we get into the syntax for an Arrow Function, let’s look at where the inspiration came from. CoffeeScript has had Arrow Functions for a while, there is a talk from Brendan Eich and Jeremy Ashkenas (1) and a post from Brendan (2) where they talk about how developers helped invent the future of JS. CoffeeScript was one of those languages that helped push JavaScript forward.

The syntax in CoffeeScript looks like this:

add = (a,b) -> 
    a + b

For ES6 they settled on this syntax:

Get hands-on with 1200+ tech skills courses.