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


#1

Hi!
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).

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

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,
Prateslj


#2

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


#3

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


#4

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.


#5

Thanks ionatan for the reply!


#6

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