Rock Paper Scissors, I am not able to output alert to properly show the wins losses and ties, please help

Rock-Paper-Scissors
  <p>Rock Paper Scissors</p>
</div>

<div>
<button onclick="
playGame('Rock');
 
  ">Rock</button>

<button onclick="
 playGame('Paper');
  
  ">Paper</button>
  
  <button onclick="
 playGame('Scissors');

">Scissors</button>

</div>

<script>

  const score = {
    wins: 0,
    losses: 0,
    ties: 0

  }

  function playGame(playerMove){

    const computerMove = pickComputerMove();


    let result = '';

      if (playerMove === 'Scissors'){

          if(computerMove === 'Rock'){
          result = ('You Lose');

        } else if(computerMove === 'Paper'){
          result = ('You Win');

        } else if (computerMove === 'Scissors'){
          result = ('Tie');

        }


      } else if(playerMove === 'Paper'){
        
          if(computerMove === 'Rock'){
        result = ('You Win');

      } else if(computerMove === 'Paper'){
        result = ('Tie');

      } else if (computerMove === 'Scissors'){
        result = ('You Lose');

      }

      }else if(playerMove === 'Rock'){
        if(computerMove === 'Rock'){
      result = ('Tie');

      } else if(computerMove === 'Paper'){
        result = ('You Lose');

      } else if (computerMove === 'Scissors'){
        result = ('You Win');

      }

      if(result === 'You Win'){
        score.wins = score.wins + 1;

      } else if(result === 'You Lose'){
        score.losses = score.losses + 1;

      }else if(result === 'Tie'){
        score.ties = score.ties + 1;
      }

      }

        alert(`You picked ${playerMove}.Computer picked ${computerMove}. ${result}
        Wins: ${score.wins}, Losses: ${score.losses}, Ties: ${score.ties}`);

  }

  function pickComputerMove(){

    const randomNumber = Math.random();

    let computerMove = '';

    if(randomNumber >= 0 && randomNumber < 1/3){
      
      computerMove = ('Rock');
    } else if(randomNumber >=1/3 && randomNumber <2/3){
      
      computerMove = ('Paper');
    } else if(randomNumber >= 2/3 && randomNumber <1){
      
      computerMove = ('Scissors');
    }

    return computerMove;
    //A return statement ends the function.

  }

 

</script>
  • share this (step/exercise) url
  • share “live” (codepn/repl/etc) link for this as well

happy coding :slight_smile: