When I run the program, it will never display the alert (the first if
statement), even if I did guess the correct number. I could also use some help on how to loop the program 5 times, I tried a for
loop with little success.
var rdmNumber = Math.random();
var timesNumber = rdmNumber * 10;
var theNumber = Math.round(timesNumber);
var userInput = prompt("Take a Guess (0-10)");
if(userInput === theNumber) {
alert("You Guessed it! " + userInput + " is correct");
} else if(userInput === theNumber.toString()) {
console.log("Higher");
} else {
console.log("Lower");
}
console.log(theNumber);