Anybody help me


#1

Anybody know my error on my syntax with error message "SyntaxError: Unexpected token }" and my syntax looks like:

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

// while loop
while(slaying) {

if(youhit = 1)  {
    console.log("You hit the Dragon!")
    totalDamage += damageThisRound;
        if(totalDamage >= 4)  {
                console.log("You slew the Dragon")
                slaying = false;
        }   
        else    {
                youHit = Math.floor(Math.random() *2)
                }
}
else    {
    console.log("The Dragon deafeated you!")
    slaying = false;
}

}

var slaying = false
}


#2

You have to take out that last bracket and the

Hope it helped!:smiley: