var arr = [1, 3, 5, 2, 2, 5, 6, 7, 8, 3, 4, 5, 6, 8, 9, 6] function uniqueArray(array) { array.sort() return array.reduce((prev, item, index) => { if (prev[prev.length - 1] !== item) { prev.push(item); } return prev; }, []) } function uniqueArray(array) { var _arr = [], map = new Map(); for (var i = 0; i < array.length; i++) { if (!map.get(array[i])) { map.set(array[i], 1) _arr.push(array[i]) } } return _arr } function uniqueArray(array) { var _arr = [], obj = {}; for (var i = 0; i < array.length; i++) { if (!obj[array[i]]) { obj[array[i]] = 1; _arr.push(array[i]) } } return _arr } function uniqueArray(array) { return Array.from(new Set(array)) } console.log(uniqueArray(arr))