I have below array and object and I am trying to replace the entire object of the array where id matches.
this.integrationActionsArray = [{id: 1, key: 'some key', value: 'some value'}]
myObject = {id: 1, key: 'another key', value: 'another value'}
so far I have made below attempts to change the one of the entire objects of an array of objects
this.integrationActionsArray
.find(data => {
if (data.id == myId) {
data = myObject
}
})
console.log(this.integrationActionsArray)
Expectation of the above log is something like below
[{id: 1, key: 'another key', value: 'another value'}]
but it is still like
[{id: 1, key: 'some key', value: 'some value'}]
I have tried using forEach, filter, map and every other iterator but still no luck.