Simple HTML Guessing Game: Number Guessing Game Tutorial
<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>
原文地址: https://www.cveoy.top/t/topic/lmlS 著作权归作者所有。请勿转载和采集!