<!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>
var num = Math.ceil(Math.random()*100)
var count = 1
do{
var num1 = prompt('请输入一个1-100数字')
if(num1 > num){
alert('猜大了')
}else if(num1 < num){
alert('猜小了')
}else{
alert('恭喜你在第' + count + '次猜中了')
}
count++
}while(num1 != num)
</script>
</body>
</html>
猜数字游戏(JS)
猜你喜欢
转载自blog.csdn.net/dfc_dfc/article/details/105521608
今日推荐
周排行