I have a name of the song, with ratings I am saving for it.
And it looks like pic bellow, as I am using push()
to store each new rating.
After get the values from database firebase, you can storege it in another array using forEach(), like so:
const arrayPlayers = []
this.db.database.ref('player').once('value')
.then((snapshot)=> {
snapshot.forEach((childSnapShot:any)=>{
arrayPlayers.push(childSnapShot.val())
})
//Here your array will be withut the node, like so:
//[3,5,1,...]
//Now sort array with JS
const sortPlayers = arrayPlayers.sort((a:any, b:any)=> b.score - a.score)
console.log(sortPlayers);
})