Computer choice: part 2


#1

This is all the code I have:
var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
console.log(computerChoice) {

if (computerChoice = (0 - 0.33)) {
console.log("rock");
} else if (computerChoice = (0.34 - 0.66)) {
console.log("paper");
} else {
console.log("scissors");
};

why does it give me: SyntaxError: Expected ';' message?

Instructions:
Under your existing code, write out the if / else if / else statement.
02. In the respective code blocks, change the value of computerChoice based on the rules stated above. Remember, you do NOT have to use var when changing the value of a variable that already exists.


#2

the error message you see refers to this line:

console.log(computerChoice) {

why is there a { after a console.log? This should be a semi-colon. There are more flaws in your code but this should be a start


#3

oh thank you :grin: :grinning:


#4

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