title: Ranking array elements
body: <p>I need an algorithm to rank elements of an array in Javascript.</p>
  <p>Example : I have an array as follows:</p>
  <pre><code>[79, 5, 18, 5, 32, 1, 16, 1, 82, 13]
  </code></pre>
  <p>I need to rank the entries by value. So <code>82</code> should receive rank <code>1</code>, <code>79</code> rank <code>2</code> etc.
  If two entries have the same value they receive the same rank and the rank for a lower value is raised.</p>
  <p>So for this array, the new ranking array would be:</p>
  <pre><code>[2, 7, 4, 7, 3, 9, 5, 9, 1, 6] 
  </code></pre>
  <p>How can I do this?</p>