#Array Sorting for Leaderboard

1 messages · Page 1 of 1 (latest)

small stone
#

How can i do it?
This is the whole code:

let factionValueLeaderBoardList = []
                    for (const player of world.getPlayers()) {
                      const facId = getScore('fac_id', player)
                      const facName = `fac${facId}`
                      const value = metricNumbers(getScore('fac_v', facName))
                      factionValueLeaderBoardList.push(`§d${facName}§5: `, `§2$§a${value}\n`)
                    }
                    //factionValueLeaderBoardList.sort() just sorts the whole thing so also the name so idk how to do it
                    player.sendMessage(factionValueLeaderBoardList)```
#

yes i know its online players only but i just wanted to test

plucky burrow
#

.sort() method

small stone
#

lol

#

i know thats how but like idk how to do it

plucky burrow
#

@small stone

small stone
#

yooo

#

it works