title: How to get the "rank" of a Array entry by it's value?
body: <p>Suppose I have the following structure</p>
  
  <pre><code>var Arr = [
    {value: 2},
    {value: 4},
    {value: 1}
  ]
  </code></pre>
  
  <p>Ok, now i want to "rank" this values by giving them a score of <code>0 -&gt; n</code> (the array size is variable) where the biggest value receive the lowest score (0) and the lowest value receives the biggest score (n).</p>
  
  <ul>
  <li>This logic just need to work with positive integers and zero.</li>
  </ul>
  
  <p>My idea is the create a function that returns the score by the array index</p>
  
  <pre><code>getScore(Arr[0]); // 1
  getScore(Arr[1]); // 0
  getScore(Arr[2]); // 2
  </code></pre>
  
  <p>But i'm really stuck and have no idea on how to do this.</p>