5 totaldamage not defined


#1

var slaying = true;
var youHit = Math.floor(Math.random()*2);
var damageThisRound = Math.floor(Math.random()*5 + 1);
var totalDamage = 0;
while(slaying) {
slaying = false;
if(youHit = 1) {
console.log("You hit the dragon");
}
else {
console.log("The dragon defeated you");
};
}

totaDamage += damageThisRound;
if(totalDamage >= 4) {
console.log("slew the drage");
slaying = false;
} else {
youHit = Math.floor(Math.random()*2);
}


#2

You forgot an "l" in totalDamage