题解 | #数组去重#
数组去重
http://www.nowcoder.com/practice/0b5ae9c4a8c546f79e2547c0179bfdc2
Array.prototype.uniq = function () { let arr=this //循环数组插入Set let set=new Set() arr.forEach(item=>{ set.add(item) }) return Array.from(set) }
数组去重
http://www.nowcoder.com/practice/0b5ae9c4a8c546f79e2547c0179bfdc2
Array.prototype.uniq = function () { let arr=this //循环数组插入Set let set=new Set() arr.forEach(item=>{ set.add(item) }) return Array.from(set) }
相关推荐