Rock Paper Scissors unexpected token


#1

Hello, I tend to go blind after staring at text for a while but I'm bugging out over this code here. I'm starting the rock paper scissors game and following the instructions and peeking at hints. I do my if, else if and else statements. I'm using the { } brackets as usual with if statements. But the console logs "unexpected token { "
so I slowly remove them from the if statement one by one after noticing it keeps making the error appear. Now I'm left with this:

if (computerChoice <= 0.33)
computerChoice = "rock";
else if (computerChoice <= 0.66)
computerChoice = "paper";
else (computerChoice >= 0.67)
computerChoice = "scissors";

and the system is congratulating me. But I'm wary to move on because it doesn't feel right. Help please? I removed the { }. Here is what the original code was before I changed anything:

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

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


#2

The problem is that you use a "condition" after else but else is the default case so there must not be any condition like thing after it. Here is an explanation why and when you can omit the {} although you should better keep them but knowing why might be useful:


#3

OH! It just hit me. I see it. Yeah, thank you. And I saved your notes on the conditions and blocks so I can do more studying offsite thanks.