As you may assume - I'm stuck ;) My problem is that I have an object with some other objects within:
let players = {
buggy: {
name: 'John',
surname: 'Cocroach',
rank: 872
},
valentino: {
name: 'Antonio',
surname: 'Valencia',
rank: 788
},
tommy: {
name: 'Tom',
surname: 'Witcher',
rank: 101
},
};
And what I want to do is to sort "players" object by "rank": (tommy(101), valentino(788), buggy(872)) or by a string (e.g. "surname"). What is more I want it to still be an object (I am using it in several other functions ;) )
I tried some ideas form here (e.g. converting to an array), but all were uneffective. What would be the best option?