I have an object:
 teamTotalChances = {
  AFC Wimbledon: 71.43,
  Accrington Stanley: 28.57,
  Barnsley: 64.28999999999999,
  Birmingham City: 114.28,
  Blackburn Rovers: 71.43
 }
That I want to order by the value (highest to lowest) so that it would then be:
teamTotalChances = {
 Birmingham City: 114.28,
 AFC Wimbledon: 71.43,
 Blackburn Rovers: 71.43,
 Barnsley: 64.28999999999999,
 Accrington Stanley: 28.57
}
I have tried a few things including Object.keys and Array.from but I can't get it to display key and value. At the minute I've got it ordered with the correct key but the value is lost:
keysSorted = Object.keys(teamTotalChances).sort(function(a,b){return 
teamTotalChances[b]-teamTotalChances[a]});
keySorted is then an Array which looks like this:
keySorted = [
 0: "Birmingham City",
 1: "AFC Wimbledon",
 2: "Blackburn Rovers",
 3: "Barnsley",
 4: "Accrington Stanley"
]
So the order is right, but I've lost the numeric value!
Thank you.
 
     
     
    