I cleared the lesson without my second else statement


#1


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 === true){
        console.log("you hit the dragon!");
        if (totalDamage >= 4)
        {
            console.log("You killed the dragon");
            slaying = false;
        }
    }else{
        console.log("the dragon eats you!")
        }
    slaying = false;
} 

I accidentally clicked the button when I had just deleted my else statement to rewrite it (because the error stated unexpected token else.) but now it says way to go and I can move on to the next piece.  What happened?


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.