Rock, Paper, Scissors in JavaScript

前端 未结 13 1719
野的像风
野的像风 2020-12-03 00:13

I\'m working on making my first game (Rock Paper Sissors) and I ran into an issue where when the userChoice is scissors and the com

13条回答
  •  一个人的身影
    2020-12-03 01:02

    var userChoice = prompt("Do you choose rock, paper or scissors? ");
    
    
    var computerChoice=Math.random();
    
    {
    
    
    if(computerChoice <= ".33") 
    
    {
        computerChoice === 'rock';
    
    
        }
    
    
        else if(computerChoice<='.66' & '>=.34')
    
    
        {
    
    computerChoice === 'paper';
    
    
            }
    
            else
    
    {
    
                computerChoice ===' scissors';
    
    
                }
    
    
                }
    
    
    console.log( computerChoice);
    

提交回复
热议问题