title: Finding the local maxima in a 1D array
body: <p>Is there an easy way to find the local maxima in a 1D array?</p>
  
  <p>Let's say I have an array:</p>
  
  <pre><code>[ 0,
    1,
    10, &lt;- max
    8,  &lt;- (ignore)
    3,
    0,
    0,
    4,
    6,  &lt;- (ignore)
    10, &lt;- max
    6,  &lt;- (ignore)
    1,
    0,
    0,
    1,
    4,  &lt;- max
    1,
    0 ]
  </code></pre>
  
  <p>I want it to find the 10s and the 4, but ignore the 8 &amp; 6, since those are next to 10s. Mathematically, you could just find where derivative is equal to zero if it were a function. I'm not too sure how to do this in Javascript. </p>