re: Useful JS functions you aren't using: Array.filter VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION

Clean it even more by extracting callbacks

const addYearToAge = person => ({...person, age: person.age + 1})
const isUnderTwelve = person => person.age < 12

students
  .map(addYearToAge)
  .filter(isUnderTwelve)
  .forEach(console.log)
code of conduct - report abuse