Getting an error in correct code

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-javascript/lessons/control-flow/exercises/else-if

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
I am getting an error saying "Did you write an else statement that logs ‘Invalid moon phase’?
", even though I have that statement.

```

var moonPhase = ‘full’;

if (moonPhase === ‘full’) {
console.log(‘Howwwlll!!’);
}
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(‘Invalid moon phase’);
}

<do not remove the three backticks above>

You could try refreshing your browser.

Else, copy your code, reset the exercise and paste it back.

1 Like

I have tried doing both these things.

Then perhaps try using another browser for this exercise?

1 Like

Mine works. As we only indicate one var for the moon full I think we do not need three equals.

/*var moonPhase = (‘full’);
if(moonPhase){
console.log(‘Howwwwlll!!’);
} else {
console.log(‘I swear I am not a werewolf…’);
} *

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