1
Good afternoon! I’m playing a simple game of joking
I created three inputs, one to enter the value user wants and another to show what was selected by the program and finally one to show the result.
I was able to take the user value and show the program value in html, but am I not able to show the result in the last input? What would be the right way?
var textoUser = $("#txtFieldUser");
var textoGanhador = $("txtFieldGanhador");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
    computerChoice = "Pedra";
} else if(computerChoice <= 0.67) {
    computerChoice = "Papel";
} else {
    computerChoice = "Tesoura";
} 
console.log("Computer: " + computerChoice);
var resultado = null;
  var compare = function (choice1, choice2) {
        if (choice1 === choice2)
            return ("O resultado é um empate!");
        else if (choice1 === "pedra") {
            if (choice2 === "tesoura")
                return ("pedra vence");
            else {
                return ("papel vence");
            }
        }
        else if (choice1 === "papel") {
            if (choice2 === "pedra")
                return "papel vence";
            else {
                return "tesoura vence";
            }
        }
        else if (choice1 === "tesoura") {
            if (choice2 === "pedra")
                return "pedra vence";
            else {
                return "tesoura vence";
            }
        }
    };
  compare(textoUser, computerChoice);
Post your code for ease
– Rafael Augusto