Break statement IS being used with each case?


#1

I am busy with number 4 of this lesson and I get the "Oops, try again. Make sure to use a break statement with each case!" notification after I run my code. I checked to see that there is a break after each of the cases and there is, so I can't figure out why its not being accepted.

Could anyone offer some help, please? Here is all of my code:

var user = prompt( "Prompt text here." ).toLowerCase(); 

switch ( user ) {
    case "one":   
        console.log( "Message for first case here." );
    break;
    case "two":   
        console.log( "Message for second case here." );
    break;
    case "three":   
        console.log( "Message for third case here." );
    break;
    case "four":   
        console.log( "Message for fourth case here." );
    break;
    default:
        console.log( "Message for default case here." );
}

I saw a question like this posted a while ago but the solution that came with it doesn't work for me.


#2

i m also trying to find the problem and i found it.Though it should not be.because your code is absolutely fine.just remove case word from console.

console.log( "Message for first case here." );  // remove case word

do same for the rest


#3

Wow, thank you! Now I can finally move on to number 5 :smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.