Second 'if' Statement


#1

I'm not sure where I'm going wrong here, any suggestions?

I'm getting the following error: SyntaxError: Unterminated string constant

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("Congratulations! You hit the dragon!");
        totalDamage += damageThisRound;
            if (totalDamage >= 4) {
                console.log("You slew the dragon!);
                slaying = false;
            } 
            else {
                youHit = Math.floor(Math.random() * 2)
            }
    } 
    else {
        Console.log("The dragon defeated you!");
        slaying = false;
    }
}.

What have i done wrong
#2

I see the missing quotation marks now, but I'm still getting an error message.


#3

Hi now try to remove the dot you have after the last closing }

....
   else {
        Console.log("The dragon defeated you!");
        slaying = false;
    }
}. <---

#4

Got it figured out, thanks!


#5

Can someone explain the whole code?