Untitled
unknown
plain_text
2 years ago
863 B
8
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="Gussing_game.js"></script>
</body>
</html>
const max=prompt("Enter the max number !");
const random=Math.floor(Math.random() * max)+1;
let guess = prompt("Guess the number ");
while(true){
if(guess=="quit"){
console.log("User Quit !");
break;
}
if(guess==random){
console.log("You are right congrats ! Random number was ",random);
break;
}
else if(guess < random){
guess = prompt("Hint : you guess was too small ,please try again ");
}
else {
guess = prompt("Hint : your guess was too large ,please try again ");
}
}
Editor is loading...
Leave a Comment