I have this code:
function Userlist(users) {
var id = "#userlist";
$(id).empty();
users.forEach(function(value, key, map) {
userlistHTML += '<li><div class="userlist_pawn'+ value.pawn +'"></div><divclass="userlist_name">' + value.name + '</div></li>';
}
});
$(id).html(userlistHTML);
}
This is a userlist from my chat app, the users have different pawns that coming with value.pawn, i made css with this classes like userlist_pawnADMIN (orange pawn image), userlist_pawnMODERATOR (white pawn image) , userlist_pawnMEMBER (blue pawn image) , ADMIN, MODERATOR and MEMBER are the values from value.pawn depending on the rank of the user, I would like to make this order that ADMIN be on the 1st place in the list, MODERATOR on the 2nd place respectively MEMBER on the 3rd place, at the moment they appear in the order of connection on chat.
HTML:
<ul id="userlist">
</ul>