Set()
// 数组去重
let arr = [1,2,4,6,3,2,6,7,7,2,9,0,1,5]
arr = [...new Set(arr)]
console.log(arr);
?
filter()
// 数组去除指定值
let arr = [1,2,4,6,3,2,6,7,7,2,9,0,1,5]
const num = 7
arr = arr.filter(item=>item!=num)
console.log(arr);
?
forEach()
// 数组去除指定值
let arr = [
{
id:1,
name:'sxx',
},
{
id:2,
name:'lxx',
},
{
id:3,
name:'xm',
},
]
arr.forEach((item)=>{
item.isPick = false;
})
console.log(arr);