// 人员数组去重(username字符串)。
distinct(array) {
let arr = array;
let result = []
let obj = {};
for (const i of arr) {
if (!obj[i]) {
result.push(i);
obj[i] = 1;
}
}
return result;
}
// 人员数组去重(username字符串)。
distinct(array) {
let arr = array;
let result = []
let obj = {};
for (const i of arr) {
if (!obj[i]) {
result.push(i);
obj[i] = 1;
}
}
return result;
}
本文标题:javascript数组去重
本文链接:https://www.haomeiwen.com/subject/gignsctx.html
网友评论