title: How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?
body: <blockquote>
    <p>This question is turned into a Q&amp;A, because I had struggle finding the answer, and think it can be useful for others</p>
  </blockquote>
  
  <p>I have a JavaScript <strong>array of values</strong> and need to calculate in JavaScript its Q2 (50th percentile aka <strong>MEDIAN</strong>), Q1 (<strong>25th percentile</strong>) and Q3 (<strong>75th percentile</strong>) values.</p>
  
  <p><a href="https://i.stack.imgur.com/L4GEM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/L4GEM.png" alt="enter image description here"></a></p>