9/9 Next Steps



I created a prompt where if the userChoice and computerChoice are the same, I'll ask the user if they want to play again. If they wrote 'yes', then the game restarts, however the prompt just keeps asking me the same thing over and over unless i don't write 'yes'

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) {
        var choice = prompt("It's a tie! Would you like to play again?");
        if (choice === "yes") {
            compare(userChoice, computerChoice);
        } else {
            return ("Thanks for playing!");


It's because userChoice isn't being set again (or computerChoice, which would easier). They are always the same; ergo, the loop.

What you have done is quite intuitive, but also indicates that loops are not yet part of your programming tool kit. It would be advisable to continue with the track modules and put this project on hold until you have completed the track. You will be able to take this project in several directions once you have all the tools in your kit.