I have a list of objects
const array = [
{club: "Club A", number: 12},
{club: "Club B", number: 12}
]
I want to add a new property in one of the objects
member: ["a", "b"]
It would be
const newArray = [
{club: "Club A", number: 12, member: ["a", "b"]},
{club: "Club B", number: 12}
]
Tried with map
const newArray = array.map(obj => check if obj.club ==="Club A" )