mercredi 12 décembre 2018

Code always showing same output (Problem with If statements in JavaScript)

I tried making a tool that calculates battle out comes but this part of the code always displays: "DRAW!"

function battle()
{
    var rawpower = document.getElementById('rawpower').value;
    var rawpoweropp = document.getElementById('rawpoweropp').value;

    if(rawpower > rawpoweropp){
        alert("You won!");
    } else if(rawpower < rawpoweropp){
        alert("You lose!");
    } else{
        alert("Draw!");
    }
}

Aucun commentaire:

Enregistrer un commentaire