从无法访问的项目Fork
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>猜数字</title> </head> <body> <script> var answer = parseInt(Math.random() * 100 + 1) var counter = 0 var yourInput do { counter += 1 yourInput = prompt('请输入你猜的数字: ') if (yourInput > answer) { alert('小一点') } else if (yourInput < answer) { alert('大一点') } else { alert('恭喜你猜对了') } } while (answer != yourInput) if (counter > 7) { alert('智商余额不足') } </script> </body> </html>