4. computer choice: part 2


#1

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

I need help with this, please.

https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#

var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
console.log(computerChoice)
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!");
}


#2

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.


#3

wow that was such an easy fix, thank you.


#5

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