const SETTING = {
name: "LOTTO",
count: 6,
maxNum: 45
}
function getRandomNum() {
const arrRanNum = new Set();
const {count, maxNum} = SETTING;
while(arrRanNum.size < count){
const num = Math.floor(Math.random() * maxNum) + 1;
console.log(num); // 랜덤 확인
arrRanNum.add(num);
}
return Array.from(arrRanNum);
}
console.log(getRandomNum());
더 좋은 방법이 있을까 궁금하네요