Dragon Slayer The First "if" Statment


#1


The first 'if' statement


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


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


#2

slaying is false, so the loop never runs


#3

Thanks for the help!


#4