Something is wrong


SyntaxError: Unexpected token '{'. Parse error.

if (computerChoice<=0.33) {computerChoice ="rock";}
else if (computerChoice=0.34>0.66) {computerChoice ="paper";}
else (computerChoice=0.67>1) {compuerChoice ="scissors";}


Your else statement shouldn't have any parentheses. Here is a template for if/elif/else:

if (condition) {
    //Do code
} else if (condition) {
    //Do code
} else {
    //Do code


The ELSE statement should not actually have condition that is why there is no parenthesis. The IF and ELSE IF contain the first two conditions (0-0.33, 0.34-0.66) so the ELSE statement automatically is for 0.67-1. :slight_smile:


SyntaxError: Unexpected token '{'. Parse error.

var compare = function (choice1, choice2) {

if (choice1 === choice2) {
    return "The result is a tie!";
}else if (choice1 === "rock") {
    return "rock wins!";
}if (choice2 === "scissors") {
    return "scissors win!"
}else (choice3  === "paper") {
    return "paper wins!";

console.log compare;


On your else statement get rid of the parentheses. You can't pass a condition to an else statement.


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