Does using ForEach with push to create an output array in javascript Anti-Pattern?

Viewed 12

Does using ForEach with push to create an output array in javascript Anti-Pattern? Or is it better to use Map?

const result = [];
arr.forEach(element => {
  result.push(element.name)
})
0 Answers
Related