const uniqSort = function (arr) {
const cache = {};
const result = [];
for (let i = 0; i < arr.length; i++) {
if (!cache[arr[i]]) {
result.push(arr[i]);
cache[arr[i]] = true;
}
}
return result.sort((a, b) => a - b);
};
console.log(uniqSort([4, 2, 2, 3, 2, 2, 2]));