I’m trying to make a roller which rolls 1 to 6 and if it rolls 6 it rolls again up to 2 times, and my problem is that if I roll two 6’s the third 6 does not roll
Also the problem might be really obvious but I tend to make stupid mistakes.
hn = 100 //Math.floor(Math.random() *100 +1)
guesses = 0;
document.getElementById('submit').onclick = function() {
guess = document.getElementById('textbox').value
if (guess > hn) {
document.getElementById('yn').innerHTML = 'Wrong, ur guess is too high!'
guesses += 1
} else if (guess < hn) {
document.getElementById('yn').innerHTML = 'Wrong, ur guess is too low!'
guesses += 1
}
//i think the prob,em is here since this is the third dice roller
else if (guess == hn) {
guesses += 1
document.getElementById('yn').innerHtml = 'HORRAY, u got it right in {guesses} tries!'
}
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h3><label id="Mylabel"> Guess a number from 1 to 100!
</label></h3>
<hr><br>
<input id="textbox" placeholder="for example 50"><br>
<hr>
<button id="submit">guess</button>
<h5><label id="yn"></label></h5>
</body>
</html>
I tried everything with my pea brain but it just does not work.