Can you tell me my mistakes?


#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.>

<In what way does your code behave incorrectly? Include ALL error messages.>
syntax error

``` 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(“congraltulation!! you hit the dragon”);
totalDamage += damageThisRound;

    if (totalDamage >= 4) {
        console.log("You WIN! player slew thedragon");
        slaying = false;
    } else {
        youHit = Math.floor(Math.random() * 2);
    }
} else(youHit === 0) {
    console.log("You lose! You missed");
    slaying = false;
}

}

<do not remove the three backticks above>

#2

wow, that took me ages. You can’t have any condition at a else clause:

else (youHit === 0) {

should be:

else {

else really means: everything else, if you are going to include conditions you might miss something


#3

@ericentrepreneur,
An ELSE statement does not take a condition
so change your

else (youHit === 0) {

into

else  {