title: array.indexOf in TypeScript/JavaScript
body: <p><strong>UPDATE: Although this question is marked as duplicated with <a href="https://stackoverflow.com/questions/8668174/indexof-method-in-an-object-array">this</a>. But @ssube's way is neat and much smarter.</strong></p>
  
  <p><strong>UPDATE2: Seems there is new way to do it in the comment by @Grungondola.</strong></p>
  
  <p>I am using Typescript.</p>
  
  <p>This works well.</p>
  
  <pre><code>var array1 = [];
  array1.push(5);
  array1.push(6);
  console.log("a", array2.indexOf(6));
  </code></pre>
  
  <p>But this does not work well. Because array2.indexOf returns -1 which means it does not find it.</p>
  
  <pre><code>var array2 = [];
  array2.push({aa:5,bb:5});
  array2.push({aa:6,bb:6});
  console.log(array2.indexOf({aa:6,bb:6}));
  </code></pre>
  
  <p>Looks like indexOf does not support Object. Does TypeScript have its own ways to deal with this kind of problem? Thanks.</p>