1.利用es6的set对象
let arrays = [11,1,2,3,2,3,4,5,6]; const uniqueArrays = (arrays) => { let result = new Set(arrays); return result; }
2.利用对象属性的唯一性
const uniqueArraysByObject = (arrays) => { let obj = {}; let result = []; for (let i of arrays) { if (!obj[i]) { result.push(i); obj[i] = 1; } } return result; }