4. Switch Help, I'm having a problem with my code


#1

Here is my code:

var firstConfirm = confirm("You live in Gotham city.")
var user = prompt("You are walking around Gotham city and out of nowhere BATMAN leaps out. Do you want to FIGHT him, TALK to him or RUN away from him?(Just type the fist word of the option you want to do. ) ").toUpperCase();

switch (user){

case 'FIGHT': 
 console.log("OKAY");
break;

case 'TALK':
    console.log("Nice");
    break; 

    case 'RUN':
        console.log(" okay run");
        break; 

        default:
        console.log("You can't" + user " Batman");

};

The error message I receive is:
SyntaxError: missing ) after argument list
(I plan to add more to my code, I'm just running into a problem. )

All help is appreciated Thanks in advanced.


#2

You have to put a + if adding a variable to a string, this goes both ways...

so your default statement should be:

    default:
    console.log("You can't" + user + " Batman");

#3

Thanks a ton, this helped a lot!