Getting an error in correct code


#1


https://www.codecademy.com/courses/learn-javascript/lessons/control-flow/exercises/else-if


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');
  }


#2

You could try refreshing your browser.

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


#3

I have tried doing both these things.


#4

Then perhaps try using another browser for this exercise?


#5

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...');
} *


#6

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