题解 | #数组去重#
数组去重
https://www.nowcoder.com/practice/7a26729a75ca4e5db49ea059b01305c9
// 編譯不通過 原來是參數寫錯了
const _deleteRepeat = array => {
// 补全代码
let obj = {}
let arrAy = []
for (let i = 0; i < array.length; i++) {
if (!obj[array[i]]) {
obj[array[i]] = true
arrAy.push(array[i])
}
}
return arrAy