<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <script> var m=parseInt(Math.random()*); var count=; for(;;){ count=count+; var num1=parseInt(prompt("请输入一个数字:")); if(num1==m){ alert("恭喜你,猜对了"); break; }else if(num1>m){ alert("大了"); }else if(num1<m){ alert("小了"); } if(count>){ alert("次数已经用完,请从新开始"); } } console.log(count); </script> </body> </html>
版权声明:除特别声明外,本站所有文章皆是本站原创,转载请以超链接形式注明出处!