The RPS Champion
MediumAcc. 94.5%
+30 XP 12
The Duel
Rock, Paper, and Scissors. The rules are ancient: Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. If both choose the same, it is a draw.
The Assignment
Your function receives two strings, p1 and p2 (Player 1 and Player 2).
Return the result as a string:
- "Player 1 Wins"
- "Player 2 Wins"
- "Draw"
01EXAMPLE 1
Input
p1="Rock", p2="Scissors"Output
"Player 1 Wins"Explanation: Rock crushes Scissors.
02EXAMPLE 2
Input
p1="Paper", p2="Paper"Output
"Draw"Explanation: Same choice results in draw.
Constraints
- Inputs are always "Rock", "Paper", or "Scissors" (capitalized).
- Return strings must match exactly.
Control FlowGame LogicFundamentals
JavaScriptSystem handles I/O — write your function only
Loading...
4 Hidden
Input Arguments
p1"Rock"
p2"Scissors"
Expected Output
Player 1 Wins
Click RUN to test your solution