4. Computer Choice: Part 2


#1

Why does the computer show unexcpected token on this code?

var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
console.log(computerChoice)

if (computerChoice < 0.34) {
computerChoice = "rock";
} if/else (computerChoice > 0.33 && computerChoice < 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}


#2

if/else, are you certain this is the right syntax?


#3

Heres the exact syntaxError: SyntaxError: Unexpected token /


#4

because if/else is not the right syntax. we have if, ? and else, what should be at the question mark?


#5

ah is it if else instead of if/else? If so it still shows an error


#6

thought it was like this:
if (condition1) {
coding;
} else if (condition2) {
coding;
} else {
coding;
}


#7

no, its also not if else. So close, maybe check earlier exercise/documentation?


#8

AAAAHHHHHHH Thank you, stupid me, such a dumb mistake...


#9