Rock Paper Scissors: Computer Choice Help


#1


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


I keep getting the error code: "Missing Before Statement". I am not sure what I am doing wrong.


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


#2

Else statements don't take conditions. They will execute when previous if/else if conditions haven't been met.

The parentheses around Scissors, do you need them?


#3

Thank you! That fixed the problem.


#4

Glad it worked out :slight_smile:


#5

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