/ Published in: JavaScript
from this page: http://dreaminginjavascript.wordpress.com/2008/08/22/eliminating-duplicates/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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);