I have array of players sorted by number of goals:
let players = [
{"name": "player1", "goals": "5"},
{"name": "player5", "goals": "4"},
{"name": "player2", "goals": "4"},
{"name": "player3", "goals": "2"},
{"name": "player4", "goals": "1"}
]
I want to show this data with the position in the table, like this:
- player1 - 5 goals
- player5 - 4 goals
- player2 - 4 goals
- player3 - 2 goals
- player4 - 1 goal
If two (or more players) have the same number of goals - they must have the same position in the table (in example - 2.), end next number in enumartion should be missed (no number 3. in this example).
How to add this type ,,position in order in array'' (i'm not sure that's good words to describe this)?