个人是用了while循环
function RandomArbitrary(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
var random= RandomArbitrary(1,10);
while(true){
var change = 10;
for(var a = 0 ; a < change; a++){
var num = prompt("请输入1-10的整数");
if(num > random){
alert('你猜的大了');
}else if(num < random){
alert('你猜的小了');
}else{
alert('你猜对了!');
break;
}
}alert('猜谜机会用完了')
}