5. Help! Two equals, rock, paper or scissors! No retorna que es un empate


#1

var usuarioElige = prompt("¿Piedra,Papel ó Tijera?");
var computadoraElige = Math.random();

if(computadoraElige<=0.33)
{
console.log("Piedra");
}

else if(computadoraElige<=0.34 && computadoraElige>=0.66)
{
console.log("Papel");
}

    else
        {
         console.log("Tijera");   
        }

var comparar = function(eleccion1,eleccion2)
{
if (eleccion1 === eleccion2)
{
return "¡El resultado es un empate!";
}
};
console.log(comparar);
comparar(usuarioElige, computadoraElige);


#2
if(computadoraElige<=0.33)
{
  console.log("Piedra"); // <--- here
}

Where I wrote here you should acutally not print but assign a value e.g.

computadoraElige = "piedra";

Because otherwise it will not be "piedra" but a random number.

The rest seems to be ok just this seems unneccessary:

console.log(comparar); -> [Function]

rather just wrap the next line in a console.log and get rid of this:

console.log(comparar(usuarioElige, computadoraElige));

Should work.


#3

Thanks haxor789, but my problem is not print "This Result is tie", excuse me for not specified


#4

Could you post the link to the exercise


#5

https://www.codecademy.com/es/courses/javascript-beginner-es-xhc8p/1/1?curriculum_id=53a32b14fed2a896c6000001


#6

Ok the returned message needs to be ¡Es un empate!. But it's strange that the error message suggest a wrong sentence.


#7

Thank´s haxor789, i resolved the problem