Play the Number Guessing Game Online - Fun and Easy!
<!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);
}
</script>
</code></pre>
</head>
<body>
<h2>Guessing Game!</h2>
<p>Try to guess the number between 1 and 10.</p>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/lmtl 著作权归作者所有。请勿转载和采集!