var arr = [1,2,3,4,5,6,7,8,9,2,3,6,6];
var obj = {}
arr.forEach(v => {
obj[v] = v
})
var newArr = []
for(var key in obj) {
newArr.push(obj[key])
}
console.log(newArr)
1540172334(1).jpg
var arr = [1,2,3,4,5,6,7,8,9,2,3,6,6];
var obj = {}
arr.forEach(v => {
obj[v] = v
})
var newArr = []
for(var key in obj) {
newArr.push(obj[key])
}
console.log(newArr)
1540172334(1).jpg
本文标题:数组去重
本文链接:https://www.haomeiwen.com/subject/hwcbzftx.html
网友评论