<script>
function hovercUnique(arr) {
var result = [], hash = {};
for (var i = 0, elem; (elem = arr[i]) != null; i++) {
if (!hash[elem]) {
result.push(elem);
hash[elem] = true;
}
}
return result;
}
var arr = [1,2,3,4,5,2,3,7];
alert(hovercUnique(arr));
</script>
JS 去除数组中重复的元素
最新推荐文章于 2020-04-02 09:24:03 发布