I am missing something... Part5


Hi, going over this code, but cant seem to find the bug. Can someone help me out.

Cheers in advance.

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===true){
        console.log("congratulations you hit the dragoni");
        totalDamage += damageThisRound; 
            if (totalDamage >= 4) {
                console.log("Player has slain the dragoni");
                slaying = false;
                (youHit = Math.floor(Math.random()*2);
        console.log("You got eaten. Sorry dude");
    slaying = false;




I was missing an additional closing bracket for my else statement.



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