使用new Set实现数组去重必须结合for of, 如果使用for循环就实现不了
var arr = new Set([1, 2, 1, 1, 2, 3, 3, 4, 4]);
for (var el of arr) {
console.log(el)
}
使用new Set实现数组去重必须结合for of, 如果使用for循环就实现不了
var arr = new Set([1, 2, 1, 1, 2, 3, 3, 4, 4]);
for (var el of arr) {
console.log(el)
}
转载于:https://www.cnblogs.com/lianxisheng/p/10422140.html