I have this code, where the point is to read lottery numbers, and the numbers can not be smaller than 0, nor bigger than 49, nor can they repeat themselves. I don't understand how to put that in the while loop. How can I compare each number is inserted with the numbers previously inserted?
var totoloto=new Array(1);
for(var i=0; i<1; i++) {
    totoloto[i]=new Array(5);
    for(var j=0; j<5; j++) {
        do {
            totoloto[i][j] = parseInt(readLine("totoloto="));
        } while (totoloto[i][j] < 1 || totoloto[i][j] > 49);
    }
    print(totoloto[i].toString().replaceAll(",", " "));
}
 
    