Ad
Code
Diff
  • function dumbRockPaperScissors(player1, player2) {
      if (player1 === player2) return "Draw";
      
      const condition = {
        Scissors: "Paper",
        Rock: "Scissors",
        Paper: "Rock",
      };
      
      return player2 === condition[player1] ? "Player 1 wins" : "Player 2 wins";
    }
    • function dumbRockPaperScissors(player1, player2) {
    • if (player1 === player2) return "Draw";
    • const condition = {
    • Scissors: "Paper",
    • Rock: "Scissors",
    • Paper: "Rock",
    • };
    • if (player2 === condition[player1]) return "Player 1 wins";
    • return "Player 2 wins";
    • return player2 === condition[player1] ? "Player 1 wins" : "Player 2 wins";
    • }