title: Find matching elements in an array
body: <p>I have an array like this {A1,B5,C6,A2,B7,C4};
  I want to loop through the array and find the matching element and then do some manipulation in that match. 
  The match in the above array is A1 and A2, B5 and B7 and finally C6 and C4.</p>
  
  <p>Below is what I have done so far:</p>
  
  <pre><code>var arr = {A1,B5,C6,A2,B7,C4};
  for (i=0; i &lt; arr.length/2; i++) // Only running till length/2 since there is always another match hence don't need to run through all the length probably
  {
  for (j=i+1; j &lt; arr.length; j++)
         {
           if(arr[i].charAt(0) == arr[j].charAt(0))
             {
               j=arr.length; //This is done to end the inner loop
               Do something;
               //if the matching element is found, ideally the i loop should ignore this record. I don't know how to do this.
             }
         }
   }
  </code></pre>