Rock, Paper, Scissors: Both choices are the same


RE: Rock, Paper, Scissors: Both choices are the same 5. Both choices are the same

It seems that the course's program won't allow me to advance. Even in a case where I transfer the exact script from the beginning of the next exercise, 6. What if choice1 is "rock", and then select the Save and Submit button, an error message pops up.

Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie.

An error message is generated at conclusion of exercise 5 even when default starting script from exercise 6 are used.

Expectations are to move onto exercise 6.

// Taken from Exercise 6 and pasted into Exercise 5 as a means of trying to // correct my efforts and test the evaluation processes of Codecademy's // environment.
/*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";


If you read the Oops message carefully, you would have seen that your return is missing an exclamation-! mark...


Wow. That's quite a literal evaluation process. Ok, thanks for the explanation. I know see that it works when adding the exclamation mark.

On a larger scope, maybe Codecademy should be made aware that grifting the starting script from exercise 6 and using it in exercise 5 will not satisfy expectations; i.e. they should add that exclamation mark to their IF statement within the declaration of the choice Function.

Thanks again for your help.


You have to remember computers are dumb as all get out, they can only do as told.


"they can only do as told".... for how much longer? :wink: