Hey guys, so i was on the Codecademy site learning Javascript and i was up to the Dragon Slayer game project. When i completed it i decided to take it further and this is what i've got so far:

(Scroll to bottom for my question)

Code:
<!DOCTYPE html>

<html>
<head>
</head>
<body>

<script type="text/javascript">
var slaying = true;

var youHit = Math.floor(Math.random() * 3); // decides how often the player will hit the dragon
var damageDealt = Math.floor(Math.random() * 4 + 1); // calculates how much damage will be dealt to dragon if hit
var totalDamageToDragon = 0;

var playerHP = 10; // Starting HP for the player

var dragonHit = Math.floor(Math.random() * 1.5); // decides how often the dragon will hit the player
var damageTaken = Math.floor(Math.random() * 6 + 2); // calculates how much damage player will take if hit
var totalDamageTaken = 0;

while(slaying){ // same as slaying === true or saying slaying === 1
    if(youHit){	// and again same as youHit === true or youHit === 1
        document.write("You slashed at the dragon and dealt " + damageDealt + " damage! Nice work! <br>");
        
		totalDamageToDragon += damageDealt;
        damageDealt = Math.floor(Math.random() * 4 + 1); // resets the variable damageDealt

        if(totalDamageToDragon >=  20){
            document.write("With that final hit, you slew the mighty dragon! You truly are a great warrior!");
            slaying = false;
        }
        else{
            document.write("The intense battle rages on! <br>");
			youHit = Math.floor(Math.random() * 4); // resetting the youHit variable
        }
    }
    else if(dragonHit){
        
		totalDamageTaken =+ damageTaken;
		playerHP = playerHP - totalDamageTaken;
		
		if(playerHP > 0){
			document.write("You fail to evade the dragon's powerful claws, and it deals " damageTaken + " damage to you! You currently have " + playerHP + " HP left. <br>");

			dragonHit = Math.floor(Math.random() * 1.5); // resets the dragonHit variable
			damageTaken = Math.floor(Math.random() * 6 + 2); // resets the damageTaken variable
		}
		else{
			document.write("With the dragon's final attack you fall to the ground, defeated. Before you can muster enough strength to rise, the dragon incinerates you with it's fiery breath and devours you. Sorry, but you lose - Try Again.");
			slaying = false;
		}
    }
	else{
		document.write("In the intense battle both your and the dragon's attacks miss each other! <br>");
	}
}
</script>


</body>
</html>
My problem is that this won't run when i try it in my main browser (i use Chrome) or IE, so it must be a syntax error or some error on my part. Only thing is i can't seem to find it

Where could i have gone wrong? Any constructive tips or any relevance info is welcome, thank you guys!