title: Find the first repeated number in a Javascript array
body: <p>I need to find <em>first two numbers</em> and show index like:</p>
  
  <pre><code>var arrWithNumbers = [2,5,5,2,3,5,1,2,4];
  </code></pre>
  
  <p>so the <em>first repeated</em> number is <code>2</code> so the variable <code>firstIndex</code> should have value 0. I must use for loop. </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>var numbers = [7, 5, 7, 6, 6, 4, 9, 10, 2, 11];
  var firstIndex
  
  for (i = numbers[0]; i &lt;= numbers.length; i++) {
    firstIndex = numbers[0]
    if (numbers[i] == firstIndex) {
      console.log(firstIndex);
      break;
    }
  }</code></pre>
  </div>
  </div>
  </p>