<html>
<head>
    <title>Guess the Number</title>
</head>
<body>
<script>
    let num = Math.floor(Math.random() * 10 + 1);
    let guess = prompt('Guess a number between 1 and 10');

    if (Number(guess) === num) {
        document.write('You guessed the number!');
    } else {
        document.write('Sorry, the number was ' + num);
    }
</script>
</body>
</html>
Simple HTML Guessing Game:  Number Guessing Game Tutorial

原文地址: https://www.cveoy.top/t/topic/lmlS 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录