title: Get index of array of objects via jquery
body: <p>I have the following array:</p>
  
  <pre><code>var = array[
              {"id" : "aa", "description" : "some description"},
              {"id" : "bb", "description" : "some more description"},
              {"id" : "cc", "description" : "a lot of description"}]
  </code></pre>
  
  <p>and I try to find the index of the array that contains the <code>id === "bb"</code>. The solution I came up with is the following:</p>
  
  <pre><code>var i = 0;
  while(array[i].id != "bb"){
     i++;
  }
  alert(i) //returns 1
  </code></pre>
  
  <p>Is there an easier way that has cross-browser functionality? I tried <code>$.inArray(id,array)</code> but it doesn't work.</p>