title: Algorithm to remove extreme outliers in array
body: <p>I've got an array which I use for the x-axis in a D3 graph, and it blows up because the chart size is too small for the size of the array. I had a look at data and there are extreme outliers in the data. See chart below.
  <img src="https://i.stack.imgur.com/jtihN.png" alt="chart"></p>
  
  <p>The data around 0 (its not totally zero, its 0.00972 etc).</p>
  
  <p>The data starts getting interesting around 70, then massive spikes about 100. the data then continues and then the same sort of thing on the other side about 200.</p>
  
  <p>Can anyone help me with some algo that removes the extreme outliers? e.g. give me 95% or 90% percentiles and remove the contiguous elements (e.g. not just one element from the middle but x number of elements from the start of the array and the end of the array, where x depends on working out where best to do it based on the data? In Javascript as well please!</p>
  
  <p>thanks!</p>
  
  <p>ps you'll need to save the image to view it properly</p>