Find duplicates without going through the list twice?
<p>I need to know if one or more duplicates exist in a list. Is there a way to do this without travelling through the list more than once?</p>

<p>Thanks guys for the suggestions. I ended up using this because it was the simplest to implement:</p>

<pre><code>var names = [];
var namesLen = names.length;
for (i=0; i&lt;namesLen; i++) {
    for (x=0; x&lt;namesLen; x++) {
        if (names[i] === names[x] &amp;&amp; (i !== x)) {alert('dupe')}
    }
}
</code></pre>
