title: Compare 2 or more consecutive numbers in an array
body: <p>I have an array: <code>A = [ 2, 2, 0, 0, -1, 1, -1, -1, -1 ]</code></p>
  <p>I want to be able to return true in instances where 2 or more consecutive numbers are the same. So in this array, the output array should have 5 trues with [2,2], [0,0], [-1,-1,-1], [-1,-1] and [-1,-1].</p>
  <p>So far I have used slice and map on the array through 2 consecutive numbers and have gotten 4 trues.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const solution = (A) =&gt; {
      let compare = A.slice(1).map((n,i) =&gt; {
         return (n === A[i])
      })
  
      console.log(compare) // =&gt; [ true, false, true, false, false, false, true, true ]
  }
  const A = [ 2, 2, 0, 0, -1, 1, -1, -1, -1 ];
  solution(A);</code></pre>
  </div>
  </div>
  </p>
  <p>But getting that fifth true on the [-1,-1,-1] is eluding me.</p>
  <p>Currently the compare output I have is only going through 2 consecutive numbers which is why it's given me 4 trues. My question is basically how to go about checking for the 3 or more consecutive numbers.</p>
  <p>My final would be something like</p>
  <pre><code>compare.filter(word =&gt; word === true).length
  </code></pre>
  <p>to get 5.</p>