I have a statement like so:
private updateVariable(anId:number): void {
this.model.forEach(q =>
{
q.anId === anId && (q.isUpdated = !q.isUpdated)
});
The model is defined as:
private model:Array<IMyData> = [];
Also IMyData is defined with this:
export interface IMyData{
anId:number;
isUpdated:boolean;
}
The goal is to iterate over the data to find the matching anId and:
change isUpdated from:
null and false to true
and from:
true to false
Thanks in advance.
nullbeing changed tofalse, you could just writeq.isUpdated = q.isUpdated ^ (q.anId === anId)