SOURCE

function getrandom(min, max) {
  return  Math.floor(Math.random() * (max - min + 1)) + min;
}
var randon = getrandom(1, 10);
console.log(randon);
numa = 1;
while(numa <= 3){ //死循环
    var num = prompt('你来猜,1~10'); //暂时隐藏
    if (num > randon){
        alert('你猜大了');
    } else if(num < randon){
  alert('你猜小了');
    }  else{
        alert('你猜对了');
        break;
    }
    numa++;
    
}
console 命令行工具 X clear

                    
>
console