Here are the instructions:
-
Create a variable named moonPhase and set it equal to full.
-
Write an if/else statement that checks if the moon is full. If the moonPhase is full, log Howl! to the console, and if it is anything else, log I swear I am not a werewolf.
Notice the code inside the first block of curly braces { } ran. That’s because moonPhase equals full, and therefore the condition evaluates to true.
Originally I coded:
let moonPhase = 'full';
if (moonPhase === true) {
console.log('Howl!');
} else {
console.log('I swear I am not a werewolf.');}
// output: I swear I am not a werewolf.
The second block of curly braces code ran, and I did not complete the second instruction. So, I switched it to:
let moonPhase = 'full';
if (moonPhase === true) { console.log('I swear I am not a werewolf.');}
else {console.log('Howl!');}
// output: Howl!
And the system marks me correct, but it does not match the statement in the instruction “Notice the code inside the first block of curly braces { } ran.”
Please help me understand and point out what I did wrong.
Thank you!
// Edit
Lesson Link:
https://www.codecademy.com/courses/learn-javascript-control-flow/lessons/control-flow/exercises/comparison-operators-ii?action=resume_content_item&course_redirect=introduction-to-javascript