Match counter with object

#1

public counter = 0;

xNum: any;

x0: any;
x1: any;
x2: any;
x3: any;
x4: any;

next(){
this.counter+=1;
this.storage.set(“Count”,this.counter);
this.logic();
}

logic(){
//automatic counter here
this.xNum=JSON.parse(JSON.stringify(“this.x”+JSON.stringify(this.counter)+"=true"));
console.log(this.xNum);
this.xNum;
}

Hi,

I hope someone can help me with this.
I have multiple objects (x1 - x4). I would like to set them true without doing it manually with all items.For this I set up a counter if which gets executed the next one will be automatically executed. The above is not working.
Does anyone have a working method/solution here?

Thank you in advance,
&
Astrix