I have a array of objects and I want to select a property of a certain object in that array. When I try the following code, it doesn't work, I don't get any value in the string:
var _string = teams[2].name;
Below the code of the array:
var teams = new Array (team1, team 2, team3);
var team1 = {
name: "team 1",
matches: 5
}
var team2 = {
name: "team 2",
matches: 4
}
var team3 = {
name: "team 3",
matches: 3
}
Some help would be great :-)
Thanks
G