I keep getting "SyntaxError: missing ) after argument list"


#1

// Write your loop below!

var ask = window.prompt("How old are you? [Enter # between 0 and 5]");

isRunning = true;

if (ask >= 6) {
console.log("Invalid entry");
isRunning = false;
}

else if (ask < 0) {
    console.log("Invalid entry");
    isRunning = false;
}

else {
console.log("You are " + ask " years old");
console.log("The problem is you have to be twenty to win..");
console.log("So let's count to twenty!");

var count = window.prompt("Begin count? Y or N");

    if (count === "y" || count === "Y") {
        do {
            console.log("You are now: " + ask);
            ask++;
        } while(ask < 21);

    }
    else if (count === "n" || count === "Y") {
        console.log("Ok, goodbye");
        isRunning = false;

    }

    else {
        console.log("Invalid entry");
        isRunning = false;

    }

}


#2

this line:

console.log("You are " + ask " years old");

missing + sign after ask.

I believe that should do the trick. In case it didn't, could you post an updated version of your code plus the url of the exercise?


#3

Oh my gosh... I can't even tell you how many times I looked through this code! You are awesome, it works now :slightly_smiling: Thank you sir


#4

And then all you miss is one tiny plus sign, i had a similar problem with a hunderd lines python script, can be so frustrating, good to hear the issue is resolved :slightly_smiling: