My code is not working, keep geeting unexpected else


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

while (slaying) {
slaying = false
if(youHit = true){
console.log("Congratulation, you just dealt the dragon a blow")
totalDamage += damageThisRound}
if (totalDamage >= 4){
console.log("the dragon is dead bro")
slaying = false}
youHit = Math.floor(Math.random() * 2)


    console.log("you are finished")


You have an Else statement on line 14 which has no brackets, no nothing, and you can't place two else's after each other.


i just added the curly bracket now, its still not working. I cant place two else statement together, but have two if statement, how do i that


Your last Else statement shouldn't need to be an else statement, just add it as a command.


okk, thanks a lot
You the boss


No problem, please Like and mark as solved :wink: Have fun coding! :smile: