The second "if" statement Dragon Slayer


#1


This is what my code looks like, but I keep getting the error saying "ReferenceError: totalDamange is not defined" every time I get a hit. The second if statement seems to be okay, but I can't figure out what's going wrong.


var slaying = true;
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;

while (slaying) {
    if (youHit) {
        console.log("You hit!");
        totalDamage += damageThisRound;
        if (totalDamange >= 4) {
            console.log ("You win!");
            slaying = false;
        } else {
            youHit = Math.floor(Math.random() * 2);
        }
            
    } else {
        console.log("You lose!");
        slaying = false;
    }
}


#2

Spelling error

Should be totalDamage


#3

Oh my brain dead head...THANK YOU!