共计 186 个字符,预计需要花费 1 分钟才能阅读完成。
1. 数组去重
` removeRepeatOptions(list) {
let obj = {};
list = list.reduce((cur, next) => {obj[next.value] ? '' : (obj[next.value] = true && cur.push(next));
return cur;
}, []); // 设置 cur 默认类型为数组,并且初始值为空的数组
return list;
},`
正文完