I am programming a small game to practice HTML and I get 3 errors

Viewed 24

This is the part of the code that gives me error, I want to make a function where every time I lose I add +1 to the losses and every time I win I add +1 to the victories.

//Condición 
            while (victorias < 3 && perdidas < 3) {
                pc = aleatorio(1, 3)
                jugador = prompt("Elige 1 para piedra, 2 para papel o 3 para tijera")
                //alert("Elegiste" + jugador)

                alert("PC elige " + elección(pc))
                alert("Tu eliges " + elección(jugador))

                //combate 2
                if(pc == jugador) {
                    alert("EMPATE") 
                } else if (jugador == 1 && pc == 3) || (jugador == 2 && pc == 1) || (jugador == 3 && pc == 2) {
                    alert("GANASTE")
                    victorias += 1
                } else {
                    alert("PERDISTE")
                    perdidas += 1
                }
                
            } alert("Ganaste " + victorias + " veces. Perdiste " + perdidas + " veces." )

enter image description here

0 Answers
Related