lorstevens
11/19/2019 - 3:25 PM

Reduce Push

Use reduce instead of pushing into an array:

const names = []
characters.forEach(character => {
  names.push(character.fullName)
})

const names = characters.reduce((names, character) => {
  return names.concat(character.fullName)
}, [])