I'm new to Javascript and jQuery and I'm trying to make an in game scoreboard for Rocket League and ran into some trouble.
Here is the console log of data
from the game:
I'm trying to access the stats like boost
contained inside the players, however, but I don't really want to change the player's names in the code every time to access it.
I was able to access the team scores by doing this
$(".scorebug .team.left .score").text(d['game']['teams'][0]['score']);
but for the players, I tried doing something like
$(".scorebug .playernames .playerBlue1").text(d['players'].child());
and
$(".scorebug .playernames .playerBlue1").text(d['players'].next());
but it doesn't work.
Is there a way I can select Buzz_2
, Foamer_5
, Heater_6
, Outlaw_1
, Sundown_3
and Tex_7
without having to type their names in the code every time? Thanks!