I need to update an array of objects by adding a key and value (e.g., age:15) to an object with the name email, while removing the age property from other objects in the array.
[
{
name: 'test',
lname: 'last',
age: 5
},
{
name: 'test1',
lname: 'last1',
age: 15
},
{
name: 'email',
lname: 'last'
}
]
For example, I want the following output:
[
{
name: 'test',
lname: 'last'
},
{
name: 'test1',
lname: 'last1'
},
{
name: 'email',
lname: 'last',
age: 15
}
]
Thank you