This commit is contained in:
Karan
2021-11-25 20:26:58 +05:30
parent 1a19d738a9
commit 569d90f511
52 changed files with 0 additions and 177 deletions
+16
View File
@@ -0,0 +1,16 @@
const max = 5;
const ranNumber = Math.floor(Math.random() * max) + 1;
//console.log(ranNumber);
let correct = false;
while (!correct) {
let guess = prompt("Guess a Number 1 - " + max);
guess = Number(guess);
if (guess === ranNumber) {
correct = true;
console.log("You got it " + ranNumber)
} else if (guess > ranNumber) {
console.log("Too high");
} else {
console.log("Too Low");
}
}