Introduction to JavaScript: Flow control 7/11 not making sense


Please help me understand what I am doing wrong in this part of the course
Introduction to JavaScript: Flow control (7/11 else if statement).

I followed the instructions and I have the code responding correctly for all the possibilities in the multiple else if statement when I change the variable (moonPhase) contents.
But even when the answer is “Invalid moon phase” in the console, there is an error message asking me: “Did you write an else statement that logs ‘Invalid moon phase’?” as can be seen in the picture below:

Please help!

Thank you,


else and { need to be on the same line, for the exercise validation.

but @ionatan is right, for JS and other languages this normally wouldn’t matter


(As far as javascript is concerned it doesn’t matter)


Thanks stetim94!

It worked!

Althought the rest of the code is the way I typed initially, as soon as I changed the code for the last else statement, that step of the course was complete.


Thanks ionatan for the reply!


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