<!DOCTYPE html>
<html>
<head>
    <title>Guessing Game!</title>
    <script>
        var answer = Math.floor(Math.random() * 10) + 1;
        var guess = prompt('Guess a number between 1 and 10:');
<pre><code>    if (parseInt(guess) === answer) {
        alert('You got it right!');
    } else {
        alert('Sorry, the number was ' + answer);
    }
&lt;/script&gt;
</code></pre>
</head>
<body>
    <h2>Guessing Game!</h2>
    <p>Try to guess the number between 1 and 10.</p>
</body>
</html>
Play the Number Guessing Game Online - Fun and Easy!

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

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