0

I have an object like this:

maps = {"08_ruinberg": 1, 
     "63_tundra": 3, 
     "35_steppes": 1, 
     "23_westfeld": 2, 
     "44_north_america": 1}

I am generating an output like this:

for (var index in empty){
    var output += empty[index]+"x "+index+"<br/>";  
}

document.getElementById('list').innerHTML = output;

What I want to do is output the names with higher values first (so for example 63_tundra would be first). I wrote this program in PHP first, where I used arsort, but in JS its a little bit harder. I tried several functions from the internetz, but they won't work.

Can somebody help me, please? Thank you!

Standard
  • 1,450
  • 17
  • 35

0 Answers0