方法一 const set = new Set([1,2,3,3,4,5,3]); console.log([...set]); //[ 1, 2, 3, 4, 5 ] 方法二 let arr = [1, 2, 3, 4, 5, 2, 23, 22, 5]; const items = new Set(arr); const array = Array.from(items); console.log(array); //[ 1, 2, 3, 4, 5, 23, 22 ]