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"; }
- function dumbRockPaperScissors(player1, player2) {
let condition = {- if (player1 === player2) return "Draw";
- const condition = {
- Scissors: "Paper",
- Rock: "Scissors",
- Paper: "Rock",
- };
switch (true) {case player2 === condition[player1]: return "Player 1 wins";case player1 === condition[player2]: return "Player 2 wins";case player1 === player2: return "Draw";}- if (player2 === condition[player1]) return "Player 1 wins";
- return "Player 2 wins";
- }