Return to Snippet

Revision: 21410
at December 11, 2009 16:56 by keith


Initial Code
var arr=[9, 7, 1, 9, 2, 3, 7, 4, 5, 4,7],
i,
arrayLength=arr.length,
out=[],
obj=[];

for (i=0; i < arrayLength; i++) {
   obj[arr[i]]=0;
}
  
for (i in obj) {
   out.push(i);
}
  
alert(out);

Initial URL

                                

Initial Description
from this page: http://dreaminginjavascript.wordpress.com/2008/08/22/eliminating-duplicates/

Initial Title
Remove Duplicate Numbers in an Array

Initial Tags
javascript

Initial Language
JavaScript