Lesson 8


Link to Exercise: (It Is Lesson 8 in the "Rock Paper Scissors" Exercise)

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";


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


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.


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


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


never mind. I got the answer. Thanks!