title: Use of Array.Filter not working in IE 8 even with the Polyfill
body: <p>I am using the following code in my project :-</p>
  
  <pre><code>uniqueArray = checkboxitems.filter(function(elem, pos, self) {
  return self.indexOf(elem) == pos;
  })
  </code></pre>
  
  <p>uniqueArray and checkboxitems are defined as <code>var uniqueArray/checkboxitems = new Array();</code></p>
  
  <p>checkboxitems array contains a list of text values used to populate checkboxes and contain duplicates.  The above code works just fine in Firefox and Google Chrome but due to missing .filter and .indexOf in IE8 it doesn't work in that browser.  So having searched on here and found references to mozillas shims such as  I tried to use it.  But it doesn't seem to work.  The res array and hence my uniqueArray variables are never populated.</p>
  
  <p>I also tried this code replacing the a and unique array with mine</p>
  
  <pre><code>var a = [1,5,1,6,4,5,2,5,4,3,1,2,6,6,3,3,2,4];
  
  // note: jQuery's filter params are opposite of javascript's native implementation :(
  var unique = $.makeArray($(a).filter(function(i,itm){ 
  // note: 'index', not 'indexOf'
  return i == $(a).index(itm);
  }));
  
  // unique: [1, 5, 6, 4, 2, 3]
  </code></pre>
  
  <p>taken from  using jquery but again this doesn't work.</p>
  
  <p>Anyone got any ideas how I can get this to work?</p>
  
  <p>Thanks
  Craig</p>
  
  <p>UPDATE I have now used from here :- <a href="https://stackoverflow.com/questions/5381621/jquery-function-to-get-all-unique-elements-from-an-array">jQuery function to get all unique elements from an array?</a></p>
  
  <pre><code>$.extend({
    distinct : function(anArray) {
       var result = [];
       $.each(anArray, function(i,v){
           if ($.inArray(v, result) == -1) result.push(v);
       });
       return result;
    }
  });
  </code></pre>
  
  <p>which works as I wanted.</p>
  
  <p>One thing I did discover however is that the code from <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf</a> resulted in the index value being incremented 1 too many!  However using the code from here <a href="https://stackoverflow.com/questions/2790001/fixing-javascript-array-functions-in-internet-explorer-indexof-foreach-etc">Fixing JavaScript Array functions in Internet Explorer (indexOf, forEach, etc.)</a> worked as expected.</p>