I\'m working on making my first game (Rock Paper Sissors) and I ran into an issue where when the userChoice is scissors and the com
You were unable to see the issue most likely due to poor indentation of your code. Properly indented the issue is clear:
if (choice1 === "paper") {
if (choice2 === "rock") {
return "paper wins";
} else {
if (choice2 === "scissors") {
return "scissors wins";
}
}
if (choice1 === "scissors") {
if (choice2 === "rock") {
return "rock wins";
} else {
if (choice2 === "paper") {
return "scissors wins";
}
}
}
}
Your if (choice1 === "scissors") { is within if (choice1 === "paper") {. The code within will never be reached.