Switch statement - what is the problem?


#1


Werewolf switch statements


Did you write 'full' as a case?


Replace this line with your code. 
var moonPhase = 'full';
//var isFoggyNight = false;

switch (moonPhase) {
  case 'full' : 
    console.log("Howl!");
    break;
  case 'mostly full' : 
    console.log("Arms and legs are  getting hairier");
    break;
  case 'mostly new' :  
    console.log("Back on two feet");
    break;
  case 'new' :  
    console.log("I swear I am not a werewolf");
    break;
  default:  
    console.log("Invalid moon phase");
    break;
}


#2

It's due to the space between the case and the colons.

case 'full' :
should be
case 'full':

Change that for each case and you're good to go.


#3

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