What am I doing wrong with this code, I can’t get it to print out the name of any of the teams. I want it to output the name of the first team or second team etc. But nothing works. Any help?
var seeds = [
{ "id" : 1, "name" : "Team 1" }
{ "id" : 2, "name" : "Team 2" }
{ "id" : 3, "name" : "Team 3" }
{ "id" : 4, "name" : "Team 4" }
{ "id" : 5, "name" : "Team 5" }
{ "id" : 6, "name" : "Team 6" }
{ "id" : 7, "name" : "Team 7" }
{ "id" : 8, "name" : "Team 8" }
]
document.write(seeds[0].name);
You forgot the commas:
seedsis anArray, and you will have to seperate the element’s with a comma, like this:Notice that there isn’t a comma after the last element.