I need filter array by bookmakers.key === ‘bovada’. I need data on this. This question is important to me for studing arrays.
const array = [
{
"id": "9ee1340b779938f9a7f829f22d41534d",
"sport_key": "soccer_argentina_primera_division",
"sport_title": "Primera DivisiĆ³n - Argentina",
"commence_time": "2023-03-30T23:00:00Z",
"home_team": "Defensa y Justicia",
"away_team": "Velez Sarsfield BA",
"bookmakers": [
{
"key": "foxbet",
"title": "FOX Bet",
"last_update": "2023-03-30T14:01:13Z",
"markets": [
{
"key": "h2h",
"last_update": "2023-03-30T14:01:13Z",
"outcomes": [
{
"name": "Argentinos Juniors",
"price": 1.74
},
{
"name": "Godoy Cruz",
"price": 5.4
},
{
"name": "Draw",
"price": 3.25
}
]
}
]
},
{
"key": "bovada",
"title": "Bovada",
"last_update": "2023-03-30T13:58:23Z",
"markets": [
{
"key": "h2h",
"last_update": "2023-03-30T13:58:23Z",
"outcomes": [
{
"name": "Argentinos Juniors",
"price": 1.74
},
{
"name": "Godoy Cruz",
"price": 5.4
},
{
"name": "Draw",
"price": 3.25
}
]
}
]
}
]
},
{
"id": "6253cf45de6b5050c44505812e12f5fd",
"sport_key": "soccer_argentina_primera_division",
"sport_title": "Primera DivisiĆ³n - Argentina",
"commence_time": "2023-03-31T00:30:00Z",
"home_team": "Argentinos Juniors",
"away_team": "Godoy Cruz",
"bookmakers": [
{
"key": "foxbet",
"title": "FOX Bet",
"last_update": "2023-03-30T14:01:13Z",
"markets": [
{
"key": "h2h",
"last_update": "2023-03-30T14:01:13Z",
"outcomes": [
{
"name": "Argentinos Juniors",
"price": 1.74
},
{
"name": "Godoy Cruz",
"price": 5.4
},
{
"name": "Draw",
"price": 3.25
}
]
}
]
},
{
"key": "bovada",
"title": "Bovada",
"last_update": "2023-03-30T13:58:23Z",
"markets": [
{
"key": "h2h",
"last_update": "2023-03-30T13:58:23Z",
"outcomes": [
{
"name": "Argentinos Juniors",
"price": 1.74
},
{
"name": "Godoy Cruz",
"price": 5.4
},
{
"name": "Draw",
"price": 3.25
}
]
},
{
"key": "spreads",
"last_update": "2023-03-30T13:58:23Z",
"outcomes": [
{
"name": "Argentinos Juniors",
"price": 1.95,
"point": -0.75
},
{
"name": "Godoy Cruz",
"price": 1.87,
"point": 0.75
}
]
}
]
}
]
},
]
I expected get the array without foxbet information. I can only filter simple arrays. I can’t filter this array for two days now…
I tried array.filter(i => i.bookmakers.filter(k => k.key === “bovada”)) but, no.