Modified Dragon Slayer - Syntax Error: Missing ) After Argument List


#1

Hello everyone,

I'm trying to do a modified Dragon Slayer game, and I keep getting "Syntax Error: missing ) after argument list."

Here's my code. Can anyone help me out?

var slaying = true;
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var dragonAttack = Math.floor(Math.random() * 5 + 1);
var yourHealth = 10;
var dragonHealth = 10;

while(slaying) {
    if (youHit) {
        dragonHealth -= damageThisRound;
        console.log("You hit the dragon and did " damageThisRound + ".");
        if (dragonHealth <= 0) {
            console.log("The dragon has no more HP left! You win!");
            slaying = false;
        } else {
            console.log("The dragon has " + dragonHealth + "HP left.");
            var youHit = Math.floor(Math.random() * 2);
        }
    } else {
        yourHealth -= dragonAttack;
        console.log("You missed! The dragon countered and did " + dragonAttack + " damage.");
        if (yourHealth <= 0) {
            console.log("You have no more HP left! You are dead.");
            slaying = false;
        } else {
            console.log("You have " + yourHealth "HP left!");
            var youHit = Math.floor(Math.random() * 2);
        }
    }
}

Thanks!
Blaine


#2

console.log("You hit the dragon and did " damageThisRound + ".");
console.log("You have " + yourHealth "HP left!");

in these lines, you are missing a concatenation (plus sign).


#3

Good catch! Unfortunately, that didn't fix it.

Thanks!


#4

Actually, yes it did! Thanks!