题解 | #数组去重#
数组去重
http://www.nowcoder.com/practice/0b5ae9c4a8c546f79e2547c0179bfdc2
第一种
const array = []
this.forEach(e => {
let target = true
if (target && !array.includes(e)) {
array.push(e)
target = false
}
})
return array
第二种
return Array.from(new Set(this))