Player Name Array Sorted By Their Scores

I feel like there’s a simple answer, but I am failing at finding it on the 'net. So I turn to the mentors of this forum:

(I’m coding in Javascript)

I have an array of player names. I also have an array of player scores. The indexes in both arrays match in regards to a player’s data (e.g. the first player’s name is contained in PlayerName[0] and their score is contained in PlayerScore[0]).

What I need is an array of the player names sorted by their score. Any ideas?

Instead of two arrays you can use a dictionary with player as key and score as values and then sort the dictionary based off values.

How do you sort a dictionary by value?

This will also allow you to handle the data for player and their respective score easily.