5. Logical Operators: 'Syntax Error: Unexpected Token Case'



var user = prompt("Ready to play? 'Y' for yes, 'N' for no, 'M' for Maybe").toUpperCase();

switch(user) {
case 'Y':
var game = prompt("Do you want to play an RTS game called SC? Y/N?").toUpperCase();
var SC = prompt("Can you play as Terran?").toUpperCase();
if(game === 'Y' && SC === 'Y'){
console.log("See you battle.net, channel apex.");
else {
console.log("Ok Noob, play Zerg or Protoss then.");
case 'N':
var girls = prompt("Do you want to go meet some girls instead? Y/N?").toUpperCase();
var nervous = prompt("Are you comfortable with meeting new people? Y/N?").toUpperCase();
if(girls === 'Y' || nervous ==='Y'){
console.log("Doesn't matter, let's go talk to some girls!")
else {
console.log("-_- ok... then what do you want to do?")}
case 'M':
var walk = prompt("Do you want to go for a walk and think about what we are gonna do? YES or NO").toUpperCase();
var beach = prompt("Do you want to go to the beach route? Y/N?").toUpperCase();
if(walk === 'Y' && beach === 'Y'){
console.log("Ok let's grab some water bottles and go!")
else {
console.log("Ok, let's just chill until we both feel like doing something.");}
console.log("I didn't understand your choice, Y/N/M?");


I think there is a little error somewhere but I can't pin point it. I've checked over a dozen times now. I'd also like to see if it could be put together more efficiently and/or easier for the next programmer to read. Any Tips on that would also be useful



Advice: try to organize your code.....later you will just see what makes it error.


could you provide me a reference to what an organized code looks like? That would help me do some reverse engineering in my learning process and build better habits.



access this site may it helps :wink:


Thanks, this is already helpful. I'll study it