No veo ningun error. Your compare function does not return 'The result is a tie!' when there is a tie


#1

undefined
**The result is a tie! **
The result is a tie! rock rock

var userChoice = prompt("Selecciona rock, paper or scissors?");
var compare = function(choice1, choice2) {
if (choice1===choice2) {
console.log("The result is a tie! " + choice1 + " " + choice2);
} else {
if (choice1 === "rock" && choice2 === "paper") {
console.log(""+choice1+" vs " +choice2 + ", gana el ordenador.");
}
if (choice1 === "rock" && choice2 === "scissors") {
console.log(""+choice1+" vs " +choice2 + ", gana el usuario");
}
if (choice1 === "paper" && choice2 === "scissors") {
console.log(""+choice1+" vs " +choice2 + ", gana el ordenador.");
}
if (choice1 === "paper" && choice2 === "rock"){
console.log(""+choice1+" vs " +choice2 + ", gana el usuario");
}
if (choice1 === "scissors" && choice2 === "rock") {
console.log(""+choice1+" vs " +choice2 + ", gana el ordenador.");
}
if (choice1 === "scissors" && choice2 === "paper") {
console.log(""+choice1+" vs " +choice2 + ", gana el usuario");
}
}
};
var aleatorio = function() {
var computerChoice = Math.random();
if (computerChoice < 0.34) { //1
computerChoice = "rock";
} //1
else { //2
if(computerChoice <= 0.67) { //3
computerChoice = "paper";
} //3
else { //4
computerChoice = "scissors";
} //4
} //2
return computerChoice;
};
aleatorio();
console.log(compare(userChoice , computerChoice));


#2

@lcanizalez,
The code-checker expects.....
You have to return one of the following strings:
"The result is a tie!" <==== with an exlamation-mark !!!
"paper wins"
"scissors wins"
"rock wins"

but you are using a console.log()
and
you are using strings like ("The result is a tie! " + choice1 + " " + choice2);