javascript - How to find position of an object in an array in JSON -
here data:
{ "bracketname": "set bracket name", "bracketid": "ttzbuz", "modid": "b11ptvjerm", "creationdate": 1503352813796, "teams": [{ "name": "team 1", }, { "name": "team 2", }, { "name": "team 2", } ] }
i trying position of team
. here code:
var content = fs.readfilesync('brackets/' + data.bracket + '.json'); content = json.parse(content); content.teams.indexof({"name": "team 2"});
but doesn't work. i'm not sure how this. me?
content.teams.findindex(team => team.name == 'team 2')
wiki
Comments
Post a Comment