Dragon Slayer! 4. Problems


#1


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
while(slaying){
    if(youHit){
        console.log("You hit!");
    }
    else{
        console.log("You missed!");
    }  
}


#2

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


#3

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


#4