Computer Choice: Part 2


#1


Computer Choice: Part 2


SyntaxError: Unexpected token {


Replace this line with your code. 
var userChoice = prompt("Do you choose rock, paper or scissors?");

var computerChoice = Math.random(){
    if (computerChoice <= 0.33) {
        computerChoice === "rock"
        }
    
    else if (computerChoice >= 0.34 && computerChoice <= 0.66) {
        computerChoice === "paper"
        }
    
    else if (computerChoice >= 0.67 && computerChoice <= 1) {
        computerChoice === "scissors"
        }
    }


console.log(computerChoice);


#2

I do not see the syntax error in my code.


#3

this line:

var computerChoice = Math.random(){

why do you have a {? math random is simply:

var computerChoice = Math.random();

that is it, math random is a function call to a built in function, not the declration of a function


#5

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