Im really confused with 7/11 i've checked everything and it seems fine to me


#1

let moonPhase = ‘full’;

if (moonPhase === ‘full’) {
console.log(‘Howl!’);
} else {
console.log(‘I swear I am not a werewolf.’);
} 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”);
}

Did you write an else if statement for if the moonPhase is mostly new?


#2

the order is always:

if
else if
else

there can’t be else if after else, since else is everything else (all remaining scenarios)


#3

the first else is from 6/11 it stayed there after i changed exercises


#4

you should have updated I swear I am not a werewolf to Invalid moon phase, you added invalid moon phase, which is fine, but then you have to remove:

else {
console.log(‘I swear I am not a werewolf.’);
} 

so the order is always: if, else if and finally else


#5

i did that before but it didnt worked so i did it again and it told me the same thing so i used the hint and it told me i had to use 3 (=) witch is not mentioned in the exercise


#6

please show me an updated version of your code


#8

One equal sign is for assigning when making a variable but for the if statement you dont want to change it to what your asking it is right?

But using the symbol in the if statement seems so natural with “if (varName (equals) value)” and since the single one it already used for assigning we can use 3 equal symbols. That way we can still use the equal sign without the worry of changing the variable’s value.
Try to think of the single (=) as “set to” and 3(=) for “check for”

Sry for the long reply xD.


#9

A post was split to a new topic: 7/11 invalid moon phase


#10

I had the same problem. It is because you have to write let moonPhase = "solar eclipse" (or something like that) instead “full”


#11

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