Switch statements


#1

There is an error message showing default case is not being included.I couldn’t figure out what’s the mistake in my code.Can anybody help?



var moonPhase = 'half';
switch(moonPhase)
    {
  case 'full': console.log('Howwwlll!!');
                  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;
									
}


https://www.codecademy.com/courses/learn-javascript/lessons/control-flow/exercises/switch?action=lesson_resume&link_content_target=interstitial_lesson


#2

default :

remove the space before :


#3

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