Lesson 8


#1

Link to Exercise: (It Is Lesson 8 in the "Rock Paper Scissors" Exercise)
https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/4?curriculum_id=506324b3a7dffd00020bf661#

Says: There was a problem with your syntax. SyntaxError: Unexpected end of input
I don't know how to really fix this issue. Please help ASAP! Thank you.


var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} console.log("Computer: " + computerChoice);
var compare = function(choice1, choice2) {
    if(choice1 === choice2) {
        return "The result is a tie!"
    }
    else if(choice1 === "rock") {
    }
        if(choice2 === "scissors") {
            return "scissors wins";
        }
        else {
            return "paper wins";
        }
    if (choice1 === "paper") {
    
        if(choice2 === "rock") {
            return "paper wins";
        }
        else {
            return "scissors wins";
        }
    if (choice1 === "scissors") {
            if (choice2 === "paper");
                return "scissors wins";
            }
            else {
                return "rock wins";
            }
console.log(userChoice);
console.log(computerChoice);
};


#2

Those lines should not be there, but } will solve the end-of-input error.


#4

Hold on. Now it says "Your code returned 'paper wins' instead of 'undefined' when the inputs are scissors and rock". What does this mean? Also, how do i fix it because before it was saying the same, thing but instead of undefined it says something like rock or scissor.


#5

It means you still haven't been asked to include the last else if section. Remove that and add it in the next lesson.


#7

No,it still is giving the same error message... Ill upload a picture.


#8

never mind. I got the answer. Thanks!


#9