SyntaxERROR: unexpected token )


The error message says SyntaxError: unexpected token )

var user = prompt("Walking down the road you see a huge Baby Duck. What do you do RUN away, PAY him or FIGHT","type answer here").toUpperCase();
switch (user){
    case('RUN') :
        var answer1 = prompt("Are you faster than a Baby Duck")
        var answer2 = prompt("Did you get a head start")
        if(answer1 || answer2){
            console.log("You where able to escape the evil Baby Duck")
        } else { 
            console.log("You where to slow and was pecked to death by the Duck")
    case ('PAY') :
        var ans1 = prompt("Do you have money?")
        var ans2 = prompt("Is it Baby Duck Dollars"?)
        if (ans1 && ans2) {
            console.log ("The duck is happy and has allowed you to pass")
        } else { 
            console.log("The duck gets angry and sits on you")
    case('FIGHT') :
        var ans3 = prompt("Are you a master in baby duck Kung-fu")
        var ans4 = prompt("Are you Strong")
        if(ans3 || ans4) {
            console.log("WOW! YOu knocked him out with one punch")
        } else{
            console.log("Oh no he's pecked your eyes out")
    console.log("Your stupid decision amuses that duck and he eats you")


HI this line

var ans2 = prompt("Is it Baby Duck Dollars"?)

you put the ? outside teh string


Cant thank you enough thanks so much


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