Guess No test

THE YEAR OF THE TIGER


Document

I am Thinking of a number Between 1-100.

Can you Guess it


No. of Guesss : 0

Guessed number are : none

var msg1 = document.getElementById("message1") var msg2 = document.getElementById("message2") var msg3 = document.getElementById("message3") var answer = Math.floor(Math.random()*100) + 1; var no_of_guesses = 0; var guesses_num = []; function play(){ var user_guess = document.getElementById("guess").value; if(user_guess < 1 || user_guess > 100 ){ alert("Please Enter a number Between 1 to 100"); } else{ guesses_num.push(user_guess); no_of_guesses+= 1; if(user_guess < answer){ msg1.textContent = "Your Guess is Too low" msg2.textContent = "No. Of Guesses : " + no_of_guesses; msg3.textContent = "Guessed Number Are: " + guesses_num; } else if(user_guess > answer){ msg1.textContent = "Your Guess is Too High" msg2.textContent = "No. Of Guesses : " + no_of_guesses; msg3.textContent = "Guessed Number Are: " + guesses_num; } else if(user_guess == answer){ msg1.textContent = "Yahhhh You won It!!" msg2.textContent = "the Number was " + answer msg3.textContent = " You guessd it in " + no_of_guesses +"Guesses"; } } }

FIND OUT MORE



WHAT'S ON

We are committed to creating a culture of Safer Gambling within our casinos. We have appointed Safer Gambling Ambassadors across all our sites, in order to protect young and vulnerable people from being exploited by gambling, prevent underage gambling and increase support for the treatment of gambling harm.

0115 872 0600 infonottingham@aleacasinos.com NG1 6LF

GET IN TOUCHOver 18s Only