4. computer choice: part 2


Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected token else

I need help with this, please.


var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
if (computerChoice <= .33) {
console.log("Your opponent chose rock!");
else if (computerChoice <= .66) {
console.log("Your opponent chose paper!");
else {
console.log("Your opponent chose scissors!");


Please format your code correctly next time you post...

You have extra semicolons after the closing curly braces for the if and else if. Attempt to remove them and see the result.


wow that was such an easy fix, thank you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.