i have an array with called my games it has a lot of property such as game type i want to fill some three ohter array based on the property game type but it did not work this is an exemple of the array my gam
hideScore: true, started: true, startedAt: "Fri, 02 Jul 2021 09:04:25 GMT", finished: true, finishedAt: "Fri, 20 Aug 2021 15:35:37 GMT", …}
archived: false
bgGame: "#1a1f29"
client: "client test"
company: "tunisia"
country: "Tunisia"
createdAt: "2021-07-02T09:03:34.015Z"
finished: true
finishedAt: "Fri, 20 Aug 2021 15:35:37 GMT"
gameType: "test"
hideScore: true
id: "60ded6668734e65c51f50996"
language: "English"
maxLevel1: 10.47195
maxLevel2: 2.065616666666668
maxScore: 23400
name: "game test"
nbrDoors: 8
nbrPlayersPerTeam: 8
partner: "khouloud ben khssib"
playtime: 30
started: true
startedAt: "Fri, 02 Jul 2021 09:04:25 GMT"
startsAt: "Fri, 02 Jul 2021 09:03:00 GMT"
teams: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
teamsCount: 20
textColor: "#ffffff"
updatedAt: "2021-08-20T15:35:37.348Z"
user: "609321b935e3f04d04d44337"
__v: 0
_id: "60ded6668734e65c51f50996"
i have three array named as gametype
NumberofLive: any[] =[];
NumberofTest: any[] =[];
NumberofDemo: any[] =[];
i want every time to fill a table i wrote something like thiss
for(let i=0;i<this.MyGames.length; i++){
switch(this.MyGames[i].gameType) {
case 'test': {
this.NumberofTest=this.NumberofTest+this.MyGames[i]
break;
}
case 'live': {
this.NumberofLive=this.NumberofLive+this.MyGames[i]
console.log('salzem'); console.log(this.NumberofLive[1].gameType)
break;
}
default: {
this.NumberofDemo=this.NumberofDemo+this.MyGames[i]
break;
}
}
}
when i log my table i find something undefined