Missing before statement?


#1

So I've been having some trouble here identifying what the missing before statement would be or if it's an issue with my syntax or what. Here's what I have:

var userChoice = prompt("Make a selection: Rock, Paper, or Scissors ");
var computerChoice = math.random(1,2,3);
    if (computerChoice <= 0.34) {
        computerChoice === "Rock"
}
    else if (computerChoice >= 0.67) {
        computerChoice === "Paper"
}
    else {
        computerChoice === "Scissors")
};
Console.log("User Selection: " + userChoice + "Computer Selection: " + computerChoice);
var compareChoice = function(userChoice, computerChoice) {
    if (userChoice === computerChoice) {
        return("It's a Draw!");
}
    else if (userChoice === Rock) {
        if (computerChoice === Scissors) {
            return("You Win!!!");
} 
        else (computerChoice === Paper) {
            return("You Lose :`( ");
}
}
    else if (userChoice === Paper) {
        if (computerChoice === Scissors) {
            return("You Lose :`( ");
}
        else (computerChoice === Rock) {
            return("You Win!!!");
}
}
    else if (userChoice === Scissors) {
        if (computerChoice === Paper) {
            return("You Win!!!");
}            
        else (computerChoice === Rock) {
            return("You Lose :`( ");
}
};

console.log(compareChoice(userChoice,computerChoice);

#2

@ar_blue17 here are some of the problems:

they all should be console.log statements.

also a return statement syntax should be like this:

return "blab";

you are missing a curly brace here:

you need another semi-colon here(at the end):

you can see if their are other bugs in your code by copying and pasting your code here

hope this helps,

Steven


#3

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