Step 13
Let's add the logic for playing the game:
if (computerChoice === userChoice) {
console.log("Draw!");
} else if (computerChoice === "rock" && userChoice === "paper") {
console.log("You win!");
} else if (computerChoice === "rock" && userChoice === "scissors") {
console.log("You lost!");
} else if (computerChoice === "paper" && userChoice === "scissors") {
console.log("You win!");
} else if (computerChoice === "paper" && userChoice === "rock") {
console.log("You lose!");
} else if (computerChoice === "scissors" && userChoice === "rock") {
console.log("You win!");
} else if (computerChoice === "scissors" && userChoice === "paper") {
console.log("You lose!");
}
Let's run and test the application: