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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -