DEV Community

Discussion on: ES6 Arrow Functions Cheatsheet

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

I've had to consider which of these I like:

// plural/singular relationships
this.children.forEach(child => child.name = 'George');
// initials, picked up from Linq usage
this.children.forEach(c => c.name = 'George');
Collapse
 
samanthaming profile image
Samantha Ming

I personally prefer the plural/singular because it’s more descriptive. It might not be as obvious because your example is only a one-liner. But once you have more logic inside the loop, it’s helpful for others to follow along your code and even yourself down the road. It takes removes the guessing 😊