I am calling an API and getting the data as such.
0: {team: {…}, league: {…}, games: {…}, substitutes: {…}, shots: {…}, …}
1: {team: {…}, league: {…}, games: {…}, substitutes: {…}, shots: {…}, …}
2: {team: {…}, league: {…}, games: {…}, substitutes: {…}, shots: {…}, …}
3: {team: {…}, league: {…}, games: {…}, substitutes: {…}, shots: {…}, …}
4: {team: {…}, league: {…}, games: {…}, substitutes: {…}, shots: {…}, …}
Now what I want to do is map through this array of objects and filter it with the same teams all in one array of objects while the other teams in another and as such.
0:
cards: {yellow: 2, yellowred: 0, red: 0}
dribbles: {attempts: 9, success: 5, past: null}
duels: {total: 113, won: 58}
fouls: {drawn: 9, committed: 16}
games: {appearences: 23, lineups: 11, minutes: 1007, number: null, position: 'Attacker', …}
goals: {total: 8, conceded: 0, assists: 3, saves: null}
league: {id: 135, name: 'Serie A', country: 'Italy', logo: 'https://media.api-sports.io/football/leagues/135.png', flag: 'https://media.api-sports.io/flags/it.svg', …}
passes: {total: 414, key: 23, accuracy: 13}
penalty: {won: null, commited: null, scored: 0, missed: 1, saved: null}
shots: {total: 42, on: 20}
substitutes: {in: 12, out: 4, bench: 14}
tackles: {total: null, blocks: 1, interceptions: 3}
team: {id: 489, name: 'AC Milan', logo: 'https://media.api-sports.io/football/teams/489.png'}
[[Prototype]]: Object
Each team will have a different Id. And since I don't know the ids of the team before hand, I don't know how to filter it otherwise. Everything is dynamic, even the ids.