Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save himynameisdave/9c294762227ac92bfeec92b5b8c0e97c to your computer and use it in GitHub Desktop.
Save himynameisdave/9c294762227ac92bfeec92b5b8c0e97c to your computer and use it in GitHub Desktop.
Reduce your fears about .reduce() - twentySomethingsLongFullNames-anonymous.js
const twentySomethingsLongFullNames = users
// First we filter only the users who are in their twenties
.filter(user => user.age >= 20 && user.age < 30)
// Combine first and last names
.map(user => `${user.firstName} ${user.lastName}`)
// Now remove any names that are 9 or less characters
.filter(fullName => fullName.length >= 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment