title: Getting index of an array's element based on its properties
body: <p>I have a JavaScript array of objects like this:</p>
  
  <pre><code>var myArray = [{...}, {...}, {...}];
  </code></pre>
  
  <p>Each object has unique <code>id</code> among other properties:</p>
  
  <pre><code>{ 
    id: 4,
    property1: 'something',
    property2: 'something'
  }
  </code></pre>
  
  <p>How can I get an index of a particular object in that array, if I only know its <code>id</code> property? So if I know that <code>myArray[x].id == 4</code>, how can I find <code>x</code>?</p>