Zepto's use of array.filter
<p>I am trying to boost my Javascript understanding, so I've been looking through the Zepto library.  I came across this line:</p>

<pre><code>uniq = function(array){
    return array.filter(function(item, idx){
        return array.indexOf(item) == idx
    })
}
</code></pre>

<p>What is the purpose of this function?  From what I can tell, it is creating a new, unique array of elements, right?  But isn't it essentially just cloning the array? If so, wouldn't <code>array.slice()</code> be faster?</p>

<p>Finally, wouldn't it increase performance to change <code>array.indexOf(item)</code> to <code>array.indexOf(item,idx)</code>?  Or better yet, just <code>return true</code>?  When does <code>array.indexOf(item)==idx</code> <em>not</em> equal true?  Is this to prevent duplicate items?  But when would that ever actually happen?</p>
