Syntax Error


#1

var slaying = true;
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totaldmg = 0;
while(slaying){
if(youHit){
console.log("YAY YOU HIT THE DRAGON!");
totaldmg += damageThisRound;
if (totaldmg >=4){
console.log("You win!");
slaying = false;
} else {
youHit = Math.floor(Match.random() * 2);
} else {
console.log("THE DRAGON DESTROYED YOU!");
slaying = false;
}
}
}

IDK I get syntax error for some reason.


#2

Oke fixed it now, some of those... { and } were placed wrong and variables must be named correctly. ^.^