Is not working


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

var slaying=true;
var youHit=Math.floor(Math.random()*2);
var damageThisRound=Math.floor(Math.random()*5+1);
var totalDamage=0
while(slaying){
if(youHit)
console.log(“you hit”);
}else{
console.log(“You missed !”);
slaying=false ;}
<In what way does your code behave incorrectly? Include ALL error messages.>
SyntaxError: Unexpected token else

```

Replace this line with your code.

<do not remove the three backticks above>

#2

@vasilisbil04,
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
   }
}

#3

thank you that is the problem