All on your own - please help


#1

Can't figure out what's wrong. Please help

SyntaxError: Unexpected token


var answer = prompt("What is your favorite football team?"); 
    
    switch (answer); {
        case 'Giants':
            console.log("Eli is the man!");
            break;
        
        case 'Cowboys':
            console.log("Boo this man!");
            break;
            
        case 'Steelers'
            console.log("Come on, you can't be serious!");
            break;
            
        default:
        console.log("pfff, horrible man!");
     
    }


#2

i've taken out the ; after (answer). Still nothing.

var answer = prompt("What is your favorite football team?");

switch (answer) {
    case 'giants':
        console.log("Eli is the man!");
        break;

    case 'cowboys':
        console.log("Boo this man!");
        break;

    case 'steelers'
        console.log("Come on, you can't be serious!");
        break;

    default:
    console.log("pfff, horrible man!");
    break;
}

#3

There is the unexpected token, in the first line of the switch.


#4

i removed that... the problem was i was missing a colon after 'steelers'

All fixed, thanks!


#5

Great! That would have been my next suggestion. Glad you kept at it and found the problem.


#6

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