Created
July 29, 2013 01:01
-
-
Save luokebi/6101540 to your computer and use it in GitHub Desktop.
js数组去重1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeDuplicates(arr) { | |
var temp = {}, | |
r = [], | |
i,k; | |
for (i = 0;i < arr.length;i++) { | |
temp[arr[i]] = true; | |
} | |
var r = []; | |
for (k in temp) { | |
r.push(k); | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment