I have an array which I want to use to store properties in.
For example:
player[0].name = bla1;
player[0].money = 130;
Now I created the for loop, but when I try to store the name in it, I get an error.
var player = [];
for(i=0; i < players; i++)
{
var x = i + 1;
var nickName = document.getElementById('player' + x + 'name').value
player[i].name = nickName;
console.log(player[i].name);
}
I got the error when I tried to add the property:
player[i].name = nickName;
console.log(player[i].name)