Whats wrong with my code? Control Flow - Switch Statements


#1

The second instruction tells me to establish each "else if" condition as a case, which I believe I've done below. What do you guys think is incorrect with my code, as the lesson is telling me I've done something incorrectly?

Here are the instructions...

"Then, write each else if condition as a case.

If moonPhase is 'full', then use console.log to print 'Howwwwlll!!'.

If moonPhase is 'mostly full', then use console.log to print 'Arms and legs are getting hairier'.

If moonPhase is 'mostly new', then use console.log to print 'Back on two feet'.

Remember to add a break after each console.log, like in the example in the instructions."

var moonPhase = 'full';



switch (moonPhase) {
    
  case 'full':
    
    console.log('Howwwwlll!!');
    
    break;
    
  case 'mostly full':
    
    console.log('Arms and legs are getting hairier');
    
    break;
    
  case 'mostly new' :
    
    console.log('Back on two feet');
    
    break;
    
  default:
    
    console.log('Invalid moon phase');
    
    break;
                 }

#2

What does it say you're doing wrong?


#3

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