Skip to content

Instantly share code, notes, and snippets.

@luokebi
Created July 29, 2013 01:01
Show Gist options
  • Save luokebi/6101540 to your computer and use it in GitHub Desktop.
Save luokebi/6101540 to your computer and use it in GitHub Desktop.
js数组去重1
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