JS移除数组中重复数据
程序员文章站
2022-03-04 12:49:27
...
<script>
var arrs = ["11","22","33","44","55","666"];
function unq(arrs ) {
var result = [], hash = {};
for (var i = 0, elem; (elem = arr[i]) != null; i++) {
if (!hash[elem]) {
result.push(elem);
hash[elem] = true;
}
}
return result;
}
console.info(unq(arrs ));
</script>
上一篇: ASP.NET输出JSON格式数据
下一篇: mac 下配置 nginx 域名转发