Rock Paper Scissors Part 2


#1


I keep getting a syntax error or a message saying it expects a semi-colon, but I'm not sure what I'm missing.


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


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

if (0 < computerChoice && computerChoice < 23){
computerChoice = "rock"}

else if (0.34 < computerChoice && computerChoice < 0.66){
computerChoice = "paper"}

else (0.67 < computerChoice && computerChoice < 1){
computerChoice = "scissors"}



console.log(computerChoice);


#2

else doesn't take a condition .. syntax for else:

else{ 
//something
}

also you should add semi colons at the end of each:

computerChoice = "something";

#3

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

if (0 < computerChoice && computerChoice < 23)
{
computerChoice = "rock"};

else if (0.34 < computerChoice && computerChoice < 0.66){
computerChoice = "paper"};

else {
computerChoice = "scissors"};



console.log(computerChoice);

Ok...am I still missing something?


#4

When closing else if, if you shouldn't have semi colons after the curly bracket


#5

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