Keep getting this: "SyntaxError: Expected ';' "


#1

var user = prompt("Which flavor would you like?").toLowerCase();

   switch (user)
   {
      case 'vanilla':
          var cone = prompt("Would you like a cone?").toLowerCase();
          var cup = prompt("Would you like a cup?").toLowerCase();
          if (cone === 'yes' || cup === 'yes')
          {
      
            console.log("Sure thing.");
          
          }
          
          else 
          {
             
            console.log("Sorry we don't have those."); 
    
          }     
          break;
          
          
      case 'chocolate':
          var sprinkles = prompt("Would you like sprinkles?").toLowerCase();
          
          var chocolate chips = prompt("How about some chocolate chips?").toLowerCase();
          
          if ( sprinkles === 'yes' && chocolate chips ==='yes' )
             {
                 console.log("Great, it's all fresh.");
             }
             else 
               {
                   console.log("Ok, here you go.");
               }   
              

          break;
          
      case 'strawberry' :
          console.log("My parents like that, I don't like the pieces so much.lol");
          break;
          
        default :
          console.log("I'm sorry, I didn't quite understand your phrasing, could you please repeat that?");
          break;
   }

I can't see what is wrong, I added semi colons to the ends of the brackets but that didn't solve it so I removed them. Can anybody see the problem?


#2

at first glance I can see that a break is missing. after case vanilla if that doesn't solve it I will take another look


#3

I have a break; after the else statement for case 'vanilla' :

Any other ideas?

Thanks


#4

http://www.codelifter.com/main/tips/tip_020.shtml

"JavaScript names must not contain spaces. Ever."


#5

Thanks I just noticed that.