I have an object array
const arr =
[
{ id: 1, name : "Joe", age:20, email: "joe@hotmail.com"},
{ id: 2, name : "Mike", age:50, email: "mike@hotmail.com"},
{ id: 3, name : "Joe", age:45, email: "harry@hotmail.com"}
]
How can I create a new array without modifying first one with only one property changed, like this (id is unique):
[
{ id: 1, name : "Joe", age:20, email: "joe@hotmail.com"},
{ id: 2, name : "Mike", age:50, email: "mike@hotmail.com"},
{ id: 3, name : "Harry", age:45, email: "harry@hotmail.com"}
]
Changed last element name property from "Joe" to "Harry"