Lesson 6 "What if Choice1 Is Rock?"


I think something might be wrong with this Lesson. The code editor refused to accept my code, kept giving me back the errors "Problem with syntax" and "end of input", even when I copy and paste the code directly from the hint.

However, when I delete everything and just hit Save & Submit it gives me the green light.

This would be fine if it wasn't clear that Lesson Six wants you to use the editor to try out the code it's giving.


I have the same problem.


@immediategratificati I am having the same problem. I have looked over line by line and cannot figure out what I'm doing wrong.


It's confusing but this thread has the answer near the end. http://discuss.codecademy.com/t/lesson-6-i-dont-know-what-im-doing-wrong/27170


Hi, I had a whole bunch of trouble with this one too. It was confusing to me as to why it allowed you to continue when you had not completed the instructions. But I ended up having too many curly brackets. If you are still having trouble I might be able to help. Would you please show me your code?


I did it quite easy. Just ask the user for an input. Call the function with that input, make some if/else statements inside the function according the user input and return something. That helped for me.
You have to know how to use functions and not to make a real game.


here's mine: 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);


what what error are you getting?


@lejuan-solo do you still need help?


@immediategratificati would you mind posting your code? "unexpected end of input" probably means that you didn't close your function so it still awaits something and therefore the end of code comes unexpected. But that is just a guess without showing your code it's hard to tell.

@lejuan-solo Is this a question or a solution? Seems a little off topic any way as this is about lesson 6 and your code is lesson 4 (guessing). Would you mind explaining it?


@lejuan-solo i dont see that you have a compare function?


did you not post that?