Need help with Rock Paper Scissors assignment Part 2


Can someone please help me figure out what's wrong with this code for building the Rock Paper Scissors game (Part 2)? It's now telling me "SyntaxError: Unexpected token else" . I've rewritten this code so many different ways and nothing seems to work! Please help! Thank you!

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

var computerChoice = Math.random();
    if (computerChoice <= 0.33) {
        computerChoice = "rock";
    else if  (computerChoice <=0.67); {
        computerChoice = "paper";
    else {
    computerChoice = "scissors";



Remove the semi-colon.

You also have your code wrapped in a block, which is unnecessary. It is not a function body. Just write the if statement,

if () {}
else if () {}
else {}

No punctuation on the structure, itself, only the statements contained within the individual blocks.


Thank you very much! :slight_smile:


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