Lesson 4: Build "Rock, Paper, Scissors"


#1


Can someone please tell me why- SyntaxError: Unexpected token {


var userChoice = prompt("Rock, paper or scissors?");
var computerChoice = Math.random(); 
if (computerChoice < 0.33) {
    computerChoice = "Rock"
}
else if (computerChoice <0.66) {
    computerChoice = "Paper"
    
}
else (computerChoice < 1) {
    computerChoice = "Scissors"
}


#2

How a if, else if, else statement should looks like

if (condition1)
   statement1
else if (condition2)
   statement2
else if (condition3)
   statement3
...
else
   statementN

You can see there should be no condition after an else. Remove that in your code


#3

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