I have a quick javascript question.
I'd like to use a variable as part of another variable name. I have 4 players. And a variable, `playerSelected = 1` (2, 3 or 4).
I also have variables such as:
player1Sword = 1;
player2Sword = 0;
player3Sword = 0;
player4Sword = 0;
Rather than doing...
`if (playerSelected == 1)` etc for each player, I'd like to do something like:
player[playerSelected]Sword = whatever
Is that possible?
↧