4. The first 'if' statement


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


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;


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.


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