1 min readOct 20, 2017
Hi Richard, thanks for this article. I agree that arrow functions help with simplifying the code and reducing developer’s effort. However in your first example you rather compare a loop to .map() method, which isn’t fait since .map() was already introduced in ES5 and was used since IE9. So a fair comparison would be:
// ES5
var petNames = pets.map(function (animal) {return animal.name});
// ES6
const petNames = pets.map(animal => animal.name);
Arrow function still looks shorter and nicer, but ES5 alternative takes only one line vs. four lines in your example. Please let me know if I’m wrong here.