title: How to determine if object is in array
body: <p>I need to determine if an object already exists in an array in javascript.</p>
  
  <p>eg (dummycode):</p>
  
  <pre><code>var carBrands = [];
  
  var car1 = {name:'ford'};
  var car2 = {name:'lexus'};
  var car3 = {name:'maserati'};
  var car4 = {name:'ford'};
  
  carBrands.push(car1);
  carBrands.push(car2);
  carBrands.push(car3);
  carBrands.push(car4);
  </code></pre>
  
  <p>now the "carBrands" array contains all instances. 
  I'm now looking a fast solution to check if an instance of car1, car2, car3 or car4 is already in the carBrands array.</p>
  
  <p>eg:</p>
  
  <pre><code>var contains =  carBrands.Contains(car1); //&lt;--- returns bool.
  </code></pre>
  
  <p>car1 and car4 contain the same data but are different instances they should be     tested as not equal.</p>
  
  <p>Do I have add something like a hash to the objects on creation? Or is there a faster way to do this in Javascript.</p>
  
  <p>I am looking for the fastest solution here, if dirty, so it has to be ;) In my app it has to deal with around 10000 instances.</p>
  
  <p><em>no jquery</em></p>