const array = Array.from({ length: 20 }, (v, i) =>
Math.floor(Math.random() * (10 - 1) + 1 ));
const set = new Set(array);
const result = [...set].slice(0, 5);
console.log(result);
const array = Array.from({ length: 10 }, (v, i) => i)
.sort((a, b) => 0.5 - Math.random())
.slice(0, 5);
console.log(array);