The first "if" statement #4)


#1

I keep getting an unexpected token error but this seems correct to me:

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 === 1) {
console.log("Congratulations, you hit the dragon!");
} else {
(youHit === 0) {
console.log("Sorry, the dragon defeated you.");
}
slaying = false;
};


#2

Hi @boardplayer86807

There only was to add "if" after "else" and change closure of it

while(slaying){
    if(youHit === 1){
        console.log("Congratulations, you hit the dragon!");
    }else if(youHit === 0){
        console.log("Sorry, the dragon defeated you.");
    }
slaying = false;
};

Hold on :wink:


#3

Doh!!! Thank you! :grinning: