I have an array of objects and I'm trying to update values in the array based on one of the object's keys.
I'm having difficulty storing my Key as a variable.
In this instance the object looks like so
If I'm to store my Object Key as a variable it fails and just adds the new element
let keyDataField = 'AUDCASH';
for (let i = this.CellRow + 1; i < this.cash2.length; i ++)
{
this.cash2[i].keyDataField = 0;
};
If it's hardcoded it works
for (let i = this.CellRow + 1; i < this.cash2.length; i++) {
this.cash2[i].AUDCASH = 0;
};
Any idea on how i can pass a variable please?