Ok, so I'm getting some data from a server like this: myVar = JSON.parse(xhttp.responseText)
. Now, my var looks something like:
{
someData1234:{
score: "5",
loc: "NY"
},
someData4321:{
score: "70",
loc: "MH"
},
someData4123:{
score: "43",
loc: "NG"
}
}
How can i sort through the object so it orders it by the score in an descending order? i tried other solutions but didn't seem to work correctly as i need the same object(or an array of objects) back but just re-ordered