4. SyntaxError: Unexpected token ( - help me debug?


Hey guys. I'm trying to figure out why this is throwing out the syntax error. Can anyone help? I'd really appreciate it!

switch(user) {
case 'PUSH':
var sure = prompt("Are you SURE?").toUpperCase();
var really = prompt("Are you really really SURE!?").toUpperCase();
if(sure === 'YES' && really === 'YES') {
console.log("The missile is launched...what did you do?!");
} else {
console.log("Good. Please don't do that again.");
case 'WALK':
var leave = prompt("Are you just gonna leave!?").toUpperCase();
var care = prompt("Do you just not care about people?").toUpperCase();
if(leave === 'YES' || care === 'NO') {
console.log("Well, that's disappointing.");
} else {
console.log("Good. Have a little faith in people.");
case 'FIGHT':
var char = prompt("Are you particularly strong or agile?").toUpperCase();
var cqc = prompt("Are you proficient in any martial arts?").toUpperCase();
if(char === 'YES' || cqc === 'YES') {
console.log.("You beat the bad guy and deactivated the nuke. Job well done!");
} else {
console.log("Oof. Well, you tried.");
console.log("Incorrect input. Try again with 'YES' or 'NO'.");

Thanks in advance :]


You entered an extra . which caused the ( which was in it's right place, to be seen as incorrect syntax following it. In the future, when you encounter a syntax error, the best solution is to search through using a find feature, whether in a browser or code editor. It could have been a multiple entry issue, or an issue such as this.


...I hate everything lol.

Thanks a lot! I can't believe I missed that. I'm gonna go jump off a bridge now :\


Completely understandable, here was my response to a similar situation. These can be quite common. I was at this one for a good 30 minutes before I realized I was missing a semicolon, this meme was the first thing that came to mind when I found it; you can imagine how I felt hahaha.