4. What is wrong with my code? It just says syntax error


#1

This is my code:

var user = prompt("You're peacefully walking through the forest when you encounter an angry troll! Do you FIGHT, TALK, BRIBE, or RUN?").toLowerCase();
switch(user) {
case 'fight':
console.log("Ypu grab a stick and poke the troll's eye. he screams in pain.");
break;
case 'talk':
console.log("You strike up a conversation with the troll. He asks you what kind of music you like.");
break;
case 'bribe':
console.log("You offer the troll one of the muffins you are carrying.");
break;
case 'run':
console.log("You run for it. the troll gives chase.");
break;
default:
console.log("Well, since you decided to not choose one of my options and take my advice, the troll eats you.");

I don't know whats wrong. It says SyntaxError: Unexpected end of input


#2

You forgot an ending curly brace.


#3

thanks a lot! it works now


#4

Welcome!

Post again if you get confused! :slightly_smiling: