A Beginner’s Guide to Arrow Functions in ES6: Part 1
https://medium.com/@josephcardillo?source=follow_footer--------------------------follow_footer- What are the benefits of arrow functions? They are more concise. They have implicit returns. (We’ll get into this below.) They do not rebind the value of this when you use an arrow function inside another function. (We’ll get into this in a later post.) How do I convert my ES5 functions to ES6 arrow functions? Let’s start with a simple example using .map() . *If you need a refresher on const , see my previous posts here and here . // Let's define an array of first names: const names = ['joe', 'rache', 'micaela']; // If I want to add my last name to each I'll run the following function using .map(): const fullNames = names.map(function(name) { return `${name} cardillo`; }); // In the console when I call: names // It returns: ['joe', 'rache', 'micaela'] // Then if I call the function: fullNames // It returns: [...