Help with if/else? I don't know what I'm doing wrong


I can't tell what I'm doing wrong! It keeps asking if I've logged "Arms and legs are getting hairier" to the console.....
I don't understand if/else statements D:

 var moonPhase = ‘full’;

if (moonPhase === ‘full’) {

if (moonPhase === ‘mostly full’)
	console.log(‘Arms and legs are getting hairier’);

else if (moonPhase === ‘mostly new’);
	console.log(‘Back on two feet’);

else (moonPhase = ‘solar eclipse’);
	console.log(‘Invalid moon phase’);


Hi there,

First. The if - else if syntax is as follows.

else if (condition)

Note that the final 'else' does not has a condition to evaluate, since if the above conditions don't match, the else will be executed.

Each statement should have their own '{}'. Also, the semicolon means end of statements, so remove those after your if/else like this one

Additionally, change the ’ for ' or ".


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