js數組去重

用es6的Set 或者用filter let arr = [1,2,3,3,6,6,77,9,3,2,1,23,68] let result = [...new Set(arr)] console.log(result) let value = arr.filter((ele,index,arr) => { return arr.indexOf(ele) === index
相關文章
相關標籤/搜索