I'mm making discord.js bot and i want make command which will write 5 users with top balance. When i runned this code
let coins = require("./coins.json");
for (var key in coins) {
if (coins.hasOwnProperty(key)) {
console.log(key + ": " + coins[key].coins);
}
}
I got returned all the strings...
298462251453775873: 2090
208120625947082752: 210
461643208422588446: 370
290099182310785025: 10
468737161563209738: 420
381182620513468417: 40
408908116101431298: 180...
So means: User: coins
. How can i sort those values without losing which user owns it?