It is sorted, but it's an array of objects. Is there a way to hash an
object?
On 12/20/06, Christof Donat <[EMAIL PROTECTED]> wrote:
Hi,
> Anyone know of a fast way to remove dups in an array?
Is the array sorted? Then you can do
function arrayUniq(a) {
var rval = [a[0]];
var o = a[0];
for( var i = 1; i < a.length; i++ ) if( a[i] != o ) {
rval.push(a[i]);
o = a[i];
}
return rval;
}
Christof
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/