I have an array of objects. I want to find by some field, and then to change it:
var item = {...} var items = [{id:2}, {id:2}, {id:2}]; var foundItem = item
worked for me
let returnPayments = [ ...this.payments ]; returnPayments[this.payments.findIndex(x => x.id == this.payment.id)] = this.payment;