Syntax Error Rock Paper Scissors Computer Choice Part 2


#1


https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#

This is the code error I'm stuck on:
"SyntaxError: Unexpected token '{'. Expected ';' after var declaration."


var userChoice = prompt("Do you choose rock, paper, or scissors?")
var computerChoice = Math.random() {
if (computerChoice <= 0.33) {
    return "rock";
} else if (computerChoice >= 0.67 {
    return "scissors";
} else {
    return "paper";
}
};
console.log(computerChoice)


#2

You forgot the semicolon at the end.

again you forgot the semicolon at the end.

Hope this helped :slight_smile:


#3

Hi @williamwallacef14,

I added the semicolons where you directed me. The error message now reads: "Syntax Error: Unexpected token {"

Here is the new code I have:

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 = "scissors";
}
};


#4

You forgot the closing paren right there.


#5

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