5/9 Your compare function does not return 'The result is a tie!' when there is a tie


#1

what am i doing wrong?!

/*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";
}
};


#2

Your code is fine. All you did wrong was that you forgot to add a "!" at the end of "The result is a tie!"


#3

well then his code isnt fine obviously. if hes missing something its wrong and he wouldnt be asking whats wrong with his code if it was already fine


#4

To me there is a difference between coding errors and spelling errors. He thought he was doing something pretty wrong but rather it is a simple spelling mistake which everyone makes once in a while. I was trying to encourage him so he wouldn't doubt his regular code but rather just to be more careful with his spelling. But that is my opinion.


#5

Agreed zeroclifawn, spelling errors are definitely different than coding errors.
This is a learning environment and as such it means that Codecademy looks for exact translation in order to move the student to the next lesson.
It is always good to be able to post your code so that someone else may pick up that spelling error.


#6

thank you so much, any replies are appreciated!