So why doesnt this work so well


#1

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

while(slaying === true;
while(slaying) {
slaying = false;
}


#2

Your code should just be

while (slaying) {
    
    
    slaying = false;
}

You have already defined slaying as true on line 1, and in the while loop, simply writing "while(slaying)"
is the same as writing"while(slaying===true)".

That line is completely unnecessary, and isn't even closed. You can either write "while(slaying === true)
or "while(slaying).
Hope I could help!!


#3

Ok, first :

Then,
while (slaying) {
slaying = false;
}