Plz Help "Rock , paper, scissors


#1

Please debug it for me I am stuck here

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

if (computerChoice <= 0.33) {
computerChoice="rock";
}

else if computerChoice >= 0.34 &&
computerChoice <= 0.66 {
computerChoice="paper";
}

else {
computerChoice="scissors";
}
};


#2

Here:

else if computerChoice >= 0.34 &&
        computerChoice <= 0.66 {

you forgot the () around your condition.


#3

thanx but it still not working !

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

console.log(userChoice);
console.log(computerChoice);

if (computerChoice <= 0.33) {
computerChoice="rock";
}

else if (computerChoice >= 0.34 &&
computerChoice <= 0.66) {
computerChoice="paper";
}

else {
computerChoice="scissors";
}
};


#4

What is the error message?
PS: Why do you have this }; at the end of your code?


#5

SyntaxError: Unexpected token }


#6

Then as said maybe get rid of the }; on your last line.