title: Jquery each - Stop loop and return object
body: <p>Can anybody tell me why the loop did not stop after the <code>5</code> entry?</p>
  
  <p><a href="http://jsbin.com/ucuqot/edit#preview" rel="noreferrer">http://jsbin.com/ucuqot/edit#preview</a></p>
  
  <hr>
  
  <pre><code>$(document).ready(function()
  {
    someArray = new Array();
    someArray[0] = 't5';
    someArray[1] = 'z12';
    someArray[2] = 'b88';
    someArray[3] = 's55';
    someArray[4] = 'e51';
    someArray[5] = 'o322';
    someArray[6] = 'i22';
    someArray[7] = 'k954';  
  
    var test =  findXX('o322');   
  
  });
  
  function findXX(word)
  {  
    $.each(someArray, function(i)
    {
      $('body').append('-&gt; '+i+'&lt;br /&gt;');
      if(someArray[i] == 'someArray')
      {
        return someArray[i]; //&lt;--- did not stop the loop!
      }   
    });  
  }
  </code></pre>