Menu
After sorting an array, is this the best way to [B]Remove duplicate array elements?
[code=html]<SCRIPT type=”text/javascript”>
var a=[‘a’,’a’,’b’,’c’,’c’,’d’,’d’,’d’,’t’,’y’,’y’,’j’,’j’]
document.write(a+’ <B>’+a.length+'</b><p>’)
i=0;while(i<a.length){if(a[i]==a[i+1]){a.splice(i,1);i–} i++}
document.write(a+’ <B>’+a.length+'</b>’)
</SCRIPT>