I am trying to create an object that looks like this:
{
Player1: [
{cardName: "test",
balanceNum: null,
ability:""}
],
Player2: [
{cardName: "test",
balanceNum: null,
ability:""}
],
.
.
.
}
At the moment I am currently using this attempt to loop through and create this dynamically. Player gets update through the loop and I want each new entry to start with player1 and continue to playerN.
var playersInfoList = [];
var playerStatus = [];
var player = "";
var index = 1;
for (i = 0; i < playerCount; i++) {
player = "player" + index++;
playerStatus.push({
cardName: "",
balanceNum: null,
ability:""
});
playersInfoList.push({
[player]: playerStatus
});
}