title: javascript find if value is NOT IN array
body: <p>My problem with this is that the loop keeps going into the if statement even for duplicate barcodes.  I'm trying to enter the if statement only for unique barcodes but at the end of the loop myArray has duplicates in it....why?</p>
  
  <pre><code>var myArray = new Array();  var i = 0;
  $("li.foo").each(function(){
     var iBarCode = $(this).attr('barcode');
     if( !( iBarCode in myArray ) ){
        myArray[i++] = iBarCode;
        //do something else
     }
  });
  </code></pre>