vendredi 14 mai 2021

i am programing a simple blackjack game but my function to" stand" will only print "you win" for all conditions met

function stand(){
                    if(gethandvalue(playerhand) < dealerhand ){
                        document.getElementById("game-status").innerHTML = "you lose";
                    }
                    if(gethandvalue(playerhand) === dealerhand){
                        document.getElementById("game-status").innerHTML =" its a tie";
                     }
                     else(gethandvalue(playerhand) > dealerhand)
                        document.getElementById("game-status").innerHTML ="you win!";
                        youwinsound.play();
                     
                    }
           

when the dealer's hand gets higher than the player hand the code still pints out "you win"

Aucun commentaire:

Enregistrer un commentaire