title: Get object keys with the highest value in Javascript
body: <p>Imagine an object like this:</p>
  
  <pre><code>var values = {
      "2": 1,
      "53": 2,
      "56": 4,
      "57": 9,
      "61": 2,
      "62": 16,
      "63": 2,
      "398": 24,
      ...
  }
  </code></pre>
  
  <p>My goal is, to find the 10 object keys, which have the highest value. In this case: 398, then 62 and so on (= <code>[398, 62, ...]</code>). I know how I can put this into an array, don't know how to receive the property key though.</p>
  
  <p>Important: I can't change the format because it's a server response.</p>
  
  <p>I tried with a <code>for (key in values) {}</code> loop but have no idea how to move on.
  <a href="https://stackoverflow.com/questions/13304543/javascript-sort-array-based-on-another-array">This similar question</a> and it's answer couldn't really help me either.</p>