SyntaxError Unexpected Token Else


My code looks fine, to me, but whenever I press save and submit code it comes up with "SyntaxError: unexpected token Else.".

var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random();
if (computerChoice <= 0.33) {
    computerChoie === "rock";
if else (0.34 <=computerChoice<= 0.66) {
    computerChoice === "paper";
else {
    computerChoice === "scissors";


You don't need three equal operators because this is assignment not conditional,


computerChoice = "rock";

computerChoice = "paper";

computerChoice = "scissors";

And also the first else if statement is written incorrectly this is how a javascript else if statement is written,

else if (condition) {

and your condition should not include 0.33 and can simply be written,

else if (computerChoice <= 0.67)


You spelt computerChoie === "rock" wrong


Hey guys it's still saying 'SyntaxError' even though I changed what both of
you said.


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