title: jQuery.unique on an array of strings
body: <p>The description of <a href="http://api.jquery.com/jQuery.unique/"><code>jQuery.unique()</code></a> states: </p>
  
  <blockquote>
    <p>Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not <strong>strings</strong> or numbers.</p>
  </blockquote>
  
  <p>With the description in mind, can someone explain why the code below works?</p>
  
  <pre><code>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;​
  </code></pre>
  
  <hr>
  
  <pre><code>var arr = ['foo', 'bar', 'bar'];
  
  $.each(arr, function(i, value){
      $('div').eq(0).append(value + ' ');
  });
  
  $.each($.unique(arr), function(i, value){
      $('div').eq(1).append(value  + ' ');
  });
  ​
  </code></pre>
  
  <p><a href="http://jsfiddle.net/essX2/">http://jsfiddle.net/essX2/</a></p>
  
  <p>Thanks</p>
  
  <p>Edit: Possible solution:</p>
  
  <pre><code>function unique(arr) {
  var i,
      len = arr.length,
      out = [],
      obj = { };
  
  for (i = 0; i &lt; len; i++) {
      obj[arr[i]] = 0;
  }
  for (i in obj) {
      out.push(i);
  }
  return out;
  };
  </code></pre>