Is not working


var slaying=true;
var youHit=Math.floor(Math.random()*2);
var damageThisRound=Math.floor(Math.random()*5+1);
var totalDamage=0
console.log("you hit");
console.log("You missed !");
slaying=false ;}

SyntaxError: Unexpected token else

Replace this line with your code.


The error is caused
by you not using an opening-curly-bracket-{ after your IF condition
you are also not closing the WHILE statement with its own closing-curly-bracket-}

The structurre should look like

while ( condition ) {
   if ( condition ) {
       //your code in the IF code-block
   else {
       //your code in the ELSE code-block


thank you that is the problem