A simple rock paper scissors exercise
Write a function called playGame
that takes two parameters, player1
and player2
, representing the choices of two players in a game of rock, paper, scissors. The function should return a string indicating the winner of the game, or "tie" if the players chose the same option. Use logical operators to check the possible outcomes of the game.
playGame("rock", "paper"); // should return "player2 wins"
playGame("scissors", "scissors"); // should return "tie"
Good Luck π