4. Computer Choice Part 2


#1


The error message I am getting is: Did you change a computerChoice between 0.67 and 1 to 'scissors'?
Please help. Not sure where my code is wrong.


var userChoice = prompt("Do you choose rock, paper or scissor?");
var computerChoice = Math.random();
{
    if (computerChoice < 0.34) 
    {
        computerChoice = "rock";
    } 
    else if (computerChoice >= 0.34 && computerChoice <= 0.66) 
    {
        computerChoice = "paper";
    } 
    else 
    {
        computerChoice = "scissor";
    }
};

console.log(userChoice);
console.log(computerChoice);


#2

nvm! the error was in the spelling of "scissors"!


#3

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