Untitled

mail@pastecode.io avatar
unknown
plain_text
11 days ago
863 B
2
Indexable
Never
<!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 ");
    }
}
Leave a Comment