ES6 Arrow Functions

An introduction to Arrow Functions and their importance.

We'll cover the following...

JavaScript ES6 introduced arrow functions expressions, which are shorter than a function expressions.

Press + to interact
// function declaration
function () { ... }
// arrow function declaration
() => { ... }

You can remove the parentheses in an arrow function expression if it only has one argument, but you have to keep the parentheses if it gets multiple arguments:

Press + to interact
// allowed
item => { ... }
// allowed
(item) => { ... }
// not allowed
item, key => { ... }
// allowed
(item, key) => { ... }
...