Else if problem (control flow, werewolf)


#1

Hi! I hope someone can explain what I am doing wrong here?


btw the lesson says it’s finished, but the code never worked?

here’s the code

let moonPhase = 'full';
if (moonPhase === 'full') {
  console.log('Howl!'); 
} else if (moonPhase === 'mostly full'); {
  console.log('Arms and legs are getting hairier'); 
} else if (moonPhase === 'mostly new'); {
  console.log('Back on two feet'); 
} else {
  console.log('I swear I am not a werewolf.');
}

link to lesson:
https://www.codecademy.com/courses/learn-javascript-control-flow/lessons/control-flow/exercises/else-if?action=resume_content_item&course_redirect=introduction-to-javascript


#2

having too many semi-colons isn’t good. for example here:

else if (moonPhase === 'mostly full');

the semi-colon will interrupt the else if clause.


#3

Thank you for a fast answer!
And I just realised that by myself as well, 5 seconds after i posted! :sweat_smile:


#4

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