这是我的数据:
xts
我正试图获得{
"bracketName": "Set Bracket Name",
"bracketId": "tTzbUZ",
"modID": "B11PTVjERm",
"creationDate": 1503352813796,
"teams": [{
"name": "team 1",
},
{
"name": "team 2",
},
{
"name": "team 2",
}
]
}
的位置。这是我的代码:
team
但它不起作用。我不知道该怎么做。有人能帮助我吗?
答案 0 :(得分:2)
content.teams.findIndex(team => team.name == 'team 2')
答案 1 :(得分:1)
您可以使用findIndex
。例如:
content.teams.findIndex(x => x.name=="team 2")