Dragon Slayer! 4. Problems


I'm don't know what is wrong. I keep getting the error below.

Oops, try again. Make sure you log a message to the console to let the player knows if (s)he won or lost!

Replace this line with your code. 

var slaying =false
var youHit=Math.floor(Math.random()*2)
var damageThisRound=Math.floor(Math.random()*5+1)
var totalDamage=0
        console.log("You hit!");
        console.log("You missed!");


the loop never executes, because slaying is false, which means nothing is logged to the console

make slaying true, but make sure to set it to false inside the loop, otherwise you created yourself an infinity loop


Thank you very much. I will keep that in mind next time I do something like this.