Dragon slaying


It says that i dont log in console who wins....

var slaying = false;
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;

        if (youHit === true)
                console.log("Congratulations, you hit the dragon!"); 
                    else {
                         console.log("The dragon defeated you.");


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


you initialize slaying as false, so the while loop never runs


Thanks, havent figure that out


did you figure it out? If problems persist, post an updated version of your code and i will help you further


yea, i experesed myself on a wrong way. Meant to say that i didnt figured it out earlier . Thanks again


can i see an updated version of your code?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.