I got a bug here


#1

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()*(1.0-0.0)+0.0;
console.log(computerChoice);
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";
    }
};
console.log(compare(computerChoice, userChoice));

#2

You have to do exactly what the instructions says

return "The result is a tie";

Therefore, an exclamation mark is missing here.

And what are you doing here?

var computerChoice = Math.random()*(1.0-0.0)+0.0;


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.