4/9 Syntax Error help needed


#1

Hi there!

Not quite sure what's wrong with the code, would greatly appreciate a correction and an explanation. Thanks!

var userChoice = prompt("Do you choose rock, paper or scissors?")

var computerChoice = Math.random(0,1)


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

#2

    else (computerChoice >= 0.67 && computerChoice <= 1) {

else is the default case so there is no further specification needed and it might even be harmful or lead to confusing results as in your case.


#3

I am having the same problem but it says i need to have

in order to run the code and prompts me with this error

"Did you change a computerChoice between 0.67 and 1 to 'scissors'?"


#4

could you post the complete code? But using this is definitely wrong so if you pass with it, it's rather bug using then the correct way of solving the exercise.