4. The first 'if' statement


#1


Ok you brilliant people.... what stupid little thing am i missing on this one??


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


SyntaxError: Invalid or unexpected token


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 the Dragon!!);
    }
    else {
        console.log("You loose!");
        slaying = false;
    }
};


#2

You didn't close your string with another ".
This will result in an unexpected EOF because it treats it all like a string that hasn't been closed.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.