5/6 Unexpected EOF


#1

Im getting an 'Unexpected EOF' response with the following code. A bit confused here.

var user = prompt("What would you like for dinner?").toUpperCase();

switch(user){
    case 'PANCAKES':
        if(user === 'PANCAKES' && user === 'DOGFOOD'){
            console.log("That sounds really gross");
        }
        else{
            console.log("I love pancakes:);
            }
        break;
    case 'BURGER':
            if(user === 'BURGER' || user === 'PANCAKES'){
                console.log("Sounds great! I'm in!");
                }
        break;
    case 'JUNK FOOD':
        console.log("That's not good for dinner");
        break;
    default:
        console.log("I don't think we can eat that.");
    }

#2

I truly do not know what 'Unexpected EOF' is, but I can see some flaws in your code.

First of all, you need another bracket to finish the first bracket in the "switch". Also, on the first "if" and "else" statement, you need to take out the colon that's after "I love pancakes. You also need a quotation mark there. That's actually all the problems I see in there, and if I'm wrong, I'm sorry. But try it out. :smile:


#3

Everything you mentioned but the extra curly bracket was correct. It works now. Thank you very much!


#4

Just for the record, the EOF in 'Unexpected EOF' means End Of File. So as the } is missing the interpreter assumes that you're just not yet ready with your program.