4/9 I Can't Get It Right!


#1

I don't know what's wrong. It's says "SyntaxError: Unexpected token else." This is what I have so far:

var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
console.log(computerChoice)
else
if (computerChoice <= .33) {
console.log("I choose rock!");
} else if (.33 < computerChoice <= .66) {
console.log("I choose paper");
} else {
console.log("I choose scissors!");
}

Any advice?


#2

first: the exercise isn't to console.log the message but you just have to do something like this

else if(computerChoice < 0.67) {
computerChoice = "paper";

you don't have to the exact same thing as I did I guess but at least you should set the string exactly to "rock" "paper" or "scissors".
(the cool thing about this is that you will change the value of computerChoice from a random number to "rock" "paper" or "scissors")


#3
.33 < computerChoice <= .66

Also this will not work, the problem is that the computer can't think in contexts so this will be read as:

(.33 < computerChoice) <= .66
(true/false) <= .66

By now you could already see that this is probably not what you planned and it doesn't. true has a numerical value of 1 and false of 0 so this does pretty much the opposite of what it should do. Better use the long way .33 < computerChoice && computerChoice <= 0.66