I want to loop over every user in the same rank.
How would I do this with the following array so I can read it by doing array[rankId].forEach
to loop over everyone with the same rank.
Array (Objects)
var array = [
{
user: '1xJs8A',
rank: 1
},
{
user: '1xJs8B',
rank: 1
},
{
user: '1xJs8C',
rank: 2
},
];
Edit: I want to be able to loop over the ranks as well, so I would need some sort of array as the following,
rankId:[
{ .. user data .. ]
]