title: Why does the result contain multiple copies of the same value?
body: <p>With the following JavaScript, why does the output contain multiple copies of the same value?</p>
  
  <pre><code>reduce = function(docs) {
    var values = [];
  
    docs.forEach(function(doc) {
      if (values.indexOf(doc.value) != -1) return;
  
      values.push(doc.value.toDateString());
    });
  
    return values;
  }
  
  doc = {value: new Date("2012-01-01T00:00:00Z")}
  
  reduce( [ doc, doc ] )
  // =&gt; ["Sat Dec 31 2011", "Sat Dec 31 2011"]
  </code></pre>