Rock, paper or scissors game


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

Computer Choice: Part 2
<Below this line, add a link to the EXACT exercise that you are stuck at.>
var userChoice = prompt(“Do you choose rock, paper or scissors?”);
var computerChoice = Math.random();
if (computerChoice <= 0.33) {
computerChoice = “rock”;
} if else (computerChoice <= 0.66) {
computerChoice = “paper”;
} else {
(computerChoice <= 1);
computerChoice = “scissors”;
}
console.log(“Computer:” + " " + computerChoice);
<In what way does your code behave incorrectly? Include ALL error messages.>
SyntaxError: Unexpected keyword ‘else’. Expected ‘(’ to start a ‘if’ condition.

```

Replace this line with your code.

<do not remove the three backticks above>

#2

No parentheses inside an if/else statement should be placed. Remove it.


#3

still same error after removing parentheses in if/else statement.ar userChoice = prompt(“Do you choose rock, paper or scissors?”);
var computerChoice = Math.random();
if (computerChoice <= 0.33) {
computerChoice = “rock”;
} if else (computerChoice <= 0.66) {
computerChoice = “paper”;
} else {
computerChoice <= 1;
computerChoice = “scissors”;
}
console.log(“Computer:” + " " + computerChoice);


#4

There’s a typo, use else if


#5

thanks zolated, it worked beautifully after correcting the typo :wink: