web老虎机

生成三个随机数
slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
检查随机数是否全部相等
if(slotOne===slotTwo&&slotTwo===slotThree){
      return slotOne;
    }else{
      return null;
    }
更新老虎机数字
$($(".slot")[0]).html(slotOne);
$($(".slot")[1]).html(slotTwo);
$($(".slot")[2]).html(slotThree);
根据不同的数字更新图片
$($('.slot')[0]).html('');
$($('.slot')[1]).html('');
$($('.slot')[2]).html('');

你可能感兴趣的:(web老虎机)