I am stuck at exercise 5


#1

my code is showing an error which iam not able to find need help with this. i am stuck at exercise 5

it is showing like "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!";
}
    else if(choice1 === "rock"){
        if(choice2 === "scissors"){
        return "rock wins";
}
        else {
            return "paper wins";}
    }

    else if (choice1 === "paper"){
        if (choice2 ==="rock"){
            return "paper wins";}
            else{
                return "scissors win";}
    }

    else if(choice1 === "scissors"){
        if(choice2 === "rock"){
            return "rock wins";
        }
        else{
            return "scissors win";}
    }
}
console.log(compare(userChoice,computerChoice))


#2

The should be spelled with uppercase first letter, strings returned need to be an exact match


#3

thank you for the reply but i didn't get your point


#4

you return: the result is a tie!, but The should be spelled with uppercase first letter/ uppercase T (checking script is case sensitive)


#5

thank you now i got it