title: Calculate quintiles/deciles from an array of numbers
body: <p>Given the following array:</p>
  
  <pre><code>[13, 468, 3, 6, 220, 762, 97, 16, 522, 69, 119, 2895, 1255, 49, 19, 261, 9, 140, 55, 20, 6, 22, 6, 17, 115]
  </code></pre>
  
  <p>I need to calculate the value that is at the 20th, 40th, 60th, and 80th percentile. The steps would be to order the array from low to high, count the total number of values, determine what value is at the 20th percentile, etc. (for example, if there are 10 numbers in order from low to high, the 2nd value would be the 20th percentile).</p>
  
  <p>This is stored in a variable and I know I can sort the numbers like this:
  <code>ticks6.sort();</code></p>
  
  <p>and get the number of values in the array with this:</p>
  
  <p><code>var newticks=ticks6.length;</code></p>
  
  <p>I have no idea how to do the next part though where I figure out the percentiles, but looking for a solution in jquery or javascript.</p>