SyntaxError: Unexpected end of input


#1



https://www.codecademy.com/courses/javascript-beginner-en-mrTNH-6VIZ9/0/4?curriculum_id=506324b3a7dffd00020bf661#


SyntaxError: Unexpected end of input


Replace this line with your code. 
var slaying = true

var youHit = Math.floor(Math.random() * 2)

var damageThisRound = Math.floor(Math.random()*5 + 1)

var totaldamage = 0

var slaying = true;
while(slaying) {
    slaying = false;
    
    while(slaying) {
        if (youHit) {
            console.log("you hit!");
        } else {
            console.log("you missed!");
 }
 slaying = false;
}


#2

Remove this line after totalDamage

And this line after the while statement

And try writing your if and else block like this it's more straightforward

if (youHit === 1) {
        console.log("Critical Hit!");
    } else if (youHit === 0) {
        console.log("The dragon has defeated you!")
    }
    slaying = false
}

#3

Yay, thanks it worked!


#4

Feel free to click the solution button if that was the answer you were looking for. :slight_smile:


#5

Eh... Where would that be? :sweat_smile:


#6

Right under my reply there is a button at the right most of the reply button that looks like a tick :sweat_smile:


#7

Alright, thanks again!


#8