Why is my code wrong?


#1


Set moonPhase to 'mostly full' and run your code.

We expect 'Arms and legs are getting hairier' to log to the console.

I have been doing this but I only get "invalid moon phase"


var moonPhase = 'solar eclipse';

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

here you set the variable moonPhase:

var moonPhase = 'solar eclipse';

the value should be mostly ful, your value is solar eclipse


#3

As @stetim94 said, you are, in fact, giving the program what you've defined as an "Invalid moon phase". The desired result is "Arms and legs are getting hairier." To accomplish this result, you need to define moonPhase, the variable that's being tested, as mostly full. So your first line looks like this instead:

var moonPhase = "mostly full";

Hope this helps.


#4

Thanks!! This works!


#5

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