Please Help 4. Computer Choice: Part 2


#1


var userChoice = prompt ("Rock, paper or scissors");
var computerChoice = Math.random();
console.log(computerChoice);

if (computerChoice <= 0.33) {
    computerChoice ="rock";
 
}else if (computerChoice > 0.34 && <=0.66) {

    computerChoice = "paper";


}else (computerChoice > 0.67)  
    computerChoice = "scissors";
}

console.log(computerChoice)


#2

this message keeps popping up and i don't know how to solve the issue.

SyntaxError: Unexpected token '<='


#3

Line 8 ...there will be another computerChoice

else if (computerChoice > 0.34 && computerChoice <=0.66)

and
the
else
statement will be
else if
because you are providing a condition to it and make sure you put an opening curly brace to it...


#4

Cool Thankyou very much :slight_smile:


#5

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