No. 5, Why does the result also print out "false"?


#1

var slaying = true;
 while(slaying) {
     slaying = false;
     if(youHit)
     {
         console.log("You got'em!");
         totalDamage += damageThisRound;
         if(totalDamage >= 4)
         {
             console.log("He's toast!");
             slaying = false;
         }
         else {
             youHit = Math.floor(Math.random() * 2);
     }
     } else {
         console.log("You lose!");
         slaying = false;
     }
     
 }

#2

I'm not sure, but I would love to know! Anybody else know?


#3

It doesn't make much sense to start with slaying = false but that not an error just well... not that good concerning the logic. Is there an error message for this code?
Unless it is undefined that last value of your code is shown in the console so if its only about the false don't bother about this that much, it's absolutely ok.