Errant break tag


#1

So I probably got carried away a little by the first part of this project but it left me with some interesting choices to mak for the second part. But I got stuck. Here's my code: Error message at the end. Right now the error seems to be a misplaced break tag but it could be something else of course. Can you get me unstuck? Thanks.

var user = prompt("What level are you on? Newbie? Student? Expert?").toUpperCase();

var level = prompt("What is your highest score?")

switch(user) {

case 'Newbie':
    if(Newbie == true && level < 10){

        console.log("Let us discuss the rules and play of the game");
    }
    else {

        console.log("Let's start at the Intermediate level");
    }
    break; 

case 'Student':
    if(Student == true || level > 10){

       console.log("Let's start at the Intermediate level");

    }
    else {

        console.log("Let's review the basics of the game");

        }
    }
     break; 
case 'Expert':
    
    if(Expert == true && level > 100){
        
        console.log("Then let's get right to it");
   
    }
    else {
        
        console.log("Let's start at the Intermediate level");
    }
    
   break;
    
default: 
   console.log("You need smarts to play this game.");
   break;

}
SyntaxError: 'break' is only valid inside a switch or loop statement.


#2

In case "student" you have an extra curly bracket under the else loop. Remove it.

var user = prompt("What level are you on? Newbie? Student? Expert?").toUpperCase();
var level = prompt("What is your highest score?")
switch(user) {
case 'NEWBIE':
if(user === "NEWBIE" && level < 10){
console.log("Let us discuss the rules and play of the game");
}
else {
console.log("Let's start at the Intermediate level");
}
break;
case 'STUDENT':
if(user === "STUDENT" || level > 10){
console.log("Let's start at the Intermediate level");
}
else{
console.log("Let's review the basics of the game");
}
break;
case 'EXPERT':
if(user === "EXPERT" && level > 100){
console.log("Then let's get right to it");
}
else{
console.log("Let's start at the Intermediate level");
}
break;
default:
console.log("You need smarts to play this game.");
break;

}


#3

Thanks. I acutally got another error after I removed that bracket and found what I thought was another superfluous bracket. Then the program ran but it always went to default. I figure I'll learn to fix that in another lesson along the way but for now the code worked for syntax purposes even though my logic was off somewhere. Thanks for getting me unstuck.


#4

Look at the code I gave you, change your cases to uppercase. The console changes the input to uppercase so your cases should be uppercase too, otherwise it will always go default.