Not getting credit for code I'm writing in "else if statements" section

Hey there,

I just started the lessons here and they’re great! However I’m not getting credit for the code I’m writing even though the output is the required output.

The code isn’t checking off on step 4 and 5 of the instructions and I can’t progress.

var moonPhase = 'solar eclipse';
if (moonPhase === 'full') { 
  console.log('Howwwwlll!!'); } 
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('I swear I am not a werewolf...'); } 

Hold up. This should be fine! Try refreshing the page?

Naw still nothing:/ In previous lessons if i messed up a number of times it would prompt me to just show the code and then it would let me progress (I would try to work it out on my own after seeing what I did wrong). I tried to get this prompt again to see if itd let me progress and it wont show up.
I’m not sure what to do at this point, I’m dead in the water.
I’ve refreshed and restarted the exercise and it always gets stuck on this last part.

did you complete step 3? At first complete step 3 then click run.
then complete step 4 then again click on run
so on…
you just have to change variable value at line 1 and click on run

In the last console.log, change the statement to ‘Invalid moon phase’

1 Like

I had been doing that, and redid it multiple times. For some reason @rypuppy03’s solution did the trick!

Thank you thank you! That worked!

The reason for it working, is because it is part of the instructions. :slight_smile:

If someone enters in an invalid moon phase, make sure to add a final else that logs ‘Invalid moon phase’

Ahhhh I’m an idiot. In my defense it was almost 6am :P. I read this, “Since there is not an else if condition for ‘solar eclipse’, we expect the default else code block to run.” thought the default was the one it already had in there, "I swear (‘I am not a werewolf…’).

Since the first 3 steps were checked off I guess I didn’t think to go back and check number 1 for the problem. I’ll need to slow down a bit for accuracy.

Thank you for the assistance!

1 Like

I’m having the same issue except my last console.log does say Invalid moon phase, so I’m not sure why it’s not registering me having changed the variable to mostly new/mostly full/solar eclipse. It won’t let me move on even though my console is logging the correct statements? Super frustrating! Any help is appreciated

  1. Head over here
  2. Use the + New Topic button
  3. Fill in the template

Someone will help!

This worked for me as well. Thanks rypuppy03!

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