If statement works fine but will not be reconized in lessons 5



Here down what comes out as error

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

/*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";
        return "The result is not a tie";
    compare("rock", "rock")

Hi everyone, i'm back with another error that i can't figger out why comes out.
The if statemen will not be reconized, but if i use it it work fine... and depend what i put when i call the function,
come the asked frase "The result is a tie" (right one). I've alse put an else statement to proove if the if statement work, and it does.

Any suggestion?

Thks you all


the string returned should be an exact match, yours already misses a exclamation mark, maybe there are more mistakes


Hi stetim94, thank you very much 4 ur answer, you right, with the excamations mark i'ver resolved the problem.
I still asking me, why should be an string, better says a text between two marks, the reason to stop the code.
The text has not very much to do with right coding, but i understand that may be there is not a way to proove if just the code is right.
Anyway you help me to solve my problem, thank you ones more.

Have a nice day


Seems whoever wrote the course decided that the string returned should be an exact match (using regular expressions to validate, exact matches are easier to validate). To be honest, i quickly picked up the habit of copying such strings from the instructions, since they are not relevant to the coding part i didn't feel bad about copy/pasting.


Yea you're right, i do the same, but in another exercise i've expeted the same error even if i've copyed the text from the text from the istructions. Anyway is my fault, i'll to practise more and more, and thank people like you that give such suport, will be easyer to learn and groove up in this language.
Thank's one more time

'till next time