I attempted to create a mini lottery game where 6 unique random numbers are chosen from 49 options. However, my code seems to have some issues. Can you please help me identify the problem and correct it?
function getNumbers(){
var numbers = [];
var randomnumber;
while(numbers.length < 6){
randomnumber = Math.ceil(Math.random()*49)
if(arr.indexOf(randomnumber) > -1) continue;
numbers[numbers.length] = randomnumber;
}
numbers.sort(sortNumber);
document.getElementById("Ausgabe").innerHTML = numbers;
}
function sortNumber(a,b) {
return a - b;
}